• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 7. CSS Optimization > Length Units: Everything Is Relative

Length Units: Everything Is Relative

Many CSS properties are specified with length measurements, either horizontal or vertical. Length values can be either positive or negative, although some properties other than length are restricted to be positive. The format of a length value is an optional sign (+ or ), followed by a number, followed by a two-letter unit abbreviation—like px (pixels), pt (points), or in (inches). For length values of 0, however, units are optional. Length units can be either relative or absolute.

Relative Length Units

Relative units measure distance relative to another length property. The relative units are em, ex, px, and % (percentage). Here they are in all their glory:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint