How to insert special characters like & and < into JSF components' value attribute?

You need to escape them to XML entities. <h:outputText value=”Tom &amp; Jerry Show” /> This problem is not related to JSF per se, but to the view technology. You’re apparently using Facelets (which is perfectly fine!). Facelets is however a XML based view technology, so you would need to ensure that the template is well … Read more

Vertical and horizontal align (middle and center) with CSS [duplicate]

There are many methods : Center horizontal and vertical align of an element with fixed measure CSS <div style=”width:200px;height:100px;position:absolute;left:50%;top:50%; margin-left:-100px;margin-top:-50px;”> <!–content–> </div> 2 . Center horizontally and vertically a single line of text CSS <div style=”width:400px;height:200px;text-align:center;line-height:200px;”> <!–content–> </div> 3 . Center horizontal and vertical align of an element with no specific measure CSS <div style=”display:table;height:300px;text-align:center;”> … Read more

Change checkbox check image to custom image

You can use pure css, just add a label to the checkbox like this: .check_box { display:none; } .check_box + label{ background:url(‘images/check-box.png’) no-repeat; height: 16px; width: 16px; display:inline-block; padding: 0 0 0 0px; } .check_box:checked + label{ background:url(‘images/check-box-checked.png’) no-repeat; height: 16px; width: 16px; display:inline-block; padding: 0 0 0 0px; } Example HTML: .check_box { display:none; … Read more

HTML 5 versus XHTML 1.0 Transitional?

HTML5 is so much easier to write than XHTML 1.0. You don’t have to manually declare the “http://www.w3.org/1999/xhtml” namespace. You don’t have to add type attributes to script and style elements (they default to text/javascript and text/css). You don’t have to use a long doctype where the browser just ignores most of it. You must … Read more

Focus Input Box On Load

There are two parts to your question. 1) How to focus an input on page load? You can just add the autofocus attribute to the input. <input id=”myinputbox” type=”text” autofocus> However, this might not be supported in all browsers, so we can use javascript. window.onload = function() { var input = document.getElementById(“myinputbox”).focus(); } 2) How … Read more

Valid content-type for XML, HTML and XHTML documents

HTML: text/html, full-stop. XHTML: application/xhtml+xml, or only if following HTML compatbility guidelines, text/html. See the W3 Media Types Note. XML: text/xml, application/xml (RFC 2376). There are also many other media types based around XML, for example application/rss+xml or image/svg+xml. It’s a safe bet that any unrecognised but registered ending in +xml is XML-based. See the … Read more

HTML list-style-type dash

There is an easy fix (text-indent) to keep the indented list effect with the :before pseudo class. ul { margin: 0; } ul.dashed { list-style-type: none; } ul.dashed > li { text-indent: -5px; } ul.dashed > li:before { content: “-“; text-indent: -5px; } Some text <ul class=”dashed”> <li>First</li> <li>Second</li> <li>Third</li> </ul> <ul> <li>First</li> <li>Second</li> <li>Third</li> … Read more

Div Z-Index issue with Flash movie

Here is a blog post that explains this issue Flash content and z-index Use <param name=”wmode” value=”transparent”> From Flash OBJECT and EMBED tag attributes wmode Possible values: window, opaque, transparent. Sets the Window Mode property of the Flash movie for transparency, layering, and positioning in the browser. * window – movie plays in its own … Read more

html5 vertical spacing issue with

Why do all browsers behave differently in HTML5 mode and all have different vertical gaps between img elements, when not specified as display: block? First of all, browsers do not have a “HTML5 mode”. What they have are three modes “Quirks”, “Limited Quirks” (aka Almost Standards) and “Standards” mode. There is only one difference between … Read more