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.

Category(s): CSS, Rules
Tags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

 

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">