CSS Units of Measurement

Basics of Web Units

Web Units of Measurement

Introduction to web measurement units

Relative Sizes

Sizes relative to the parent's font size

Sizes relative to the page's default font size

The following shows the result of a div tag that includes the following declarations

1.) This is an M.
2.) This is an M.
3.) This is an M.
4.) This is an M.
5.) This is an M.
6.) This is an M.
7.) This is an M.
8.) This is an M.
9.) This is an M.
MMMMMMMMMM

A pixel is relative to the computer's resolution setting

Print sizes

These units are used for hard copy print outs

Assignment

    1. Create a new html5 file and name it yourlastname_J06.html
    2. Make the following into a bulleted list:
      broccoli
      cabbage
      carrots
      cauliflower
      celery
    3. Make classes using the same names as the list items.
      • For example
        .asparagus
    4. For each class, make declarations using the font-size property using the values listed in the next step.
      • For example, for the following:
        • asparagus 125%
      • Make the following rule:
        • .asparagus {font-size: 125%;}
      • Then apply the class to the corresponding list item tag. For example:
        • <li class=asparagus>asparagus</li>
    5. Here are the names to use for the classes and the values to assign to them:
      • Be sure to use the correct unit names.
      • broccoli - 2 ems
      • cabbage - small
      • carrots - extra, extra small
      • cauliflower - 18 pixels
      • celery - extra large

Further information