CSS Rules 1 : ex ,em,px Know the difference

Css Rules No 1
There are two types of length units: relative and absolute. Relative length units
specify a length relative to another length property. Style sheets that use relative
units will more easily scale from one medium to another (e.g., from a computer
display to a laser printer).
Relative units are:
em: the ’font-size’ of the relevant font
ex: the ’x-height’ of the relevant font
px: pixels, relative to the viewing device
Example(s):

h1 { margin: 0.5em } /* em */
h1 { margin: 1ex } /* ex */
p { font-size: 12px } /* px */

The ’em’ unit is equal to the computed value of the ’font-size’ property of the
element on which it is used. The exception is when ’em’ occurs in the value of the
’font-size’ property itself, in which case it refers to the font size of the parent element.
It may be used for vertical or horizontal measurement.

Popularity: 9% [?]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

May27

Leave a Reply