WDD 130: Web Fundamentals

W02 Learning Activity: CSS Units of Measurement

Overview

In CSS, property length values are needed to provide layout and presentation control. There are two main types - absolute and relative. The absolute length, like 10px (pixels), is not relative to anything else and is typically the same size on most devices. Relative lengths, like 90%, are dependent on other items including the parent, sibling, or the size of the viewport.

Prepare

Activity Instructions

In this activity, answer the following questions about CSS value units/lengths.

  1. What is the most common absolute length unit for screens?
    Help – Scroll down to Absolute length units to find the answer.
    Check Your Understanding

    px (pixels)

  2. Which CSS relative length unit is based upon the font size of the root element?
    Check Your Understanding

    rem

  3. Given a hexadecimal (base16) color value of #0e421c, what value is the Green level?
    Check Your Understanding

    42

    There are two hexadecimal values per color. First red, then green, and then blue. That is why there are six total characters with values in hex (0 to F).

Optional Resources