The Units of CSS can be grouped into four catagories.

 

  • Length Units
  • Percentage Units
  • Color Units
  • URL's

 

Length Units

 

  • em
  • ex
  • px
  • pt
  • pc

 

Relative Length Units

Relative Units are used when you want your pages to scale evenly across a range of output devices.

 

em- The height of the elements font

letter-spacing: 0.1em

 

ex- The height of the letter "x" in the element's font

margin: 1ex

 

px- Pixels

font-size: 12px

 

Absolute Link Units

These units are called, "real world" units. These are best used for print work, or other occasions when the type of output device is known.

 

pt-Points

font-size: 14pt

 

pc-Picas (1pc=12pt)

font-size: 2pc

 

Percentage Units

 

Percentage units are relative to other values. Most often the percentage value is relative to the element's font size.

It is formed by a + or -, followed by a number, and followed by a %. There is NO spacing!!!

 

Color Units

 

Color units are specified in CSS by keywords, or RGB codes.

 

Example:

 

body{color: blue; background-color:#FF3399}

body{color: blue; background-color:#FF3399}

 

 

URL's

 

A URL can be single quotes ('), or double quoted (")

 

Example of a URL:

http://www.google.com

 

 

 

 

Information found at www.elated.com/articles/css-units/

 


Page Information

  • 10 months ago [history]
  • View page source
  • You're not logged in
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts