Thursday, December 18, 2008

Zero Font Size

Each of the major browsers render text of zero units (or percentage) differently. Firefox 3 does not display the text. Internet Explorer 7 and Internet Explorer 6 render the text with a height of 1 pixel. Opera 9.6 does not display the text. Safari 3.1 renders 0em , 0ex and 0% text with a text size of 9px and renders text of 0px and zero absolute length units with a height of 1px.
Examples:
<p style="font-size: 0em;">jumps over the lazy dog</p>
<p style="font-size: 0ex;">jumps over the lazy dog</p>
<p style="font-size: 0%;">jumps over the lazy dog</p>
<p style="font-size: 0px;">jumps over the lazy dog</p>
<p style="font-size: 0pt;">jumps over the lazy dog</p>
<p style="font-size: 0mm;">jumps over the lazy dog</p>
<p style="font-size: 0cm;">jumps over the lazy dog</p>
<p style="font-size: 0in;">jumps over the lazy dog</p>
<p style="font-size: 0pc;">jumps over the lazy dog</p>

Friday, December 5, 2008

Font Size: Leading and Trailing Zeroes

When specifying a font size, the value can have leading and trailing zeroes or they can be omitted completely. This does not affect the way the text is rendered.

Leading Zeroes

Zeros that appear at the beginning of a number are called leading zeroes. Example: font-size:0.5in - the first digit is a leading zero. In all major browsers, leading zeroes are optional. Therefore font-size:.5in is a valid way of specifying font size. There can also be more than one leading zero.

Trailing zero

Zeroes that appear after a decimal point and at the end of the number are called trailing zeroes. Example: font-size:2.50em - the last digit is a trailing zero. In all major browsers, trailing zeroes are optional. Therefore, all the following declarations result in the same font size:
font-size: 2.5em
font-size:2.50em
font-size: 2.500em