Color and Units
Color notations. #2B1F17 is hexadecimal, three pairs for red, green and blue. rgb(43 31 23) is the same thing in decimal. hsl(28 30% 13%) describes hue, saturation and lightness, which is far easier to reason about when you want a lighter version of a color you already have.
All three produce identical pixels. Choose the one that makes your intent readable.
Units, and the one that matters most. px is an absolute pixel. rem is relative to the root font size, which the visitor can change in their browser settings. em is relative to the current element's font size. % is relative to the parent. vw and vh are percentages of the viewport.
Use rem for type and spacing. If you size text in px, a visitor who has increased their default font size because they cannot read small text gets nothing. Their setting is simply overridden. rem respects it.
Mark this lesson complete
Signed in, your progress follows you to every device.