Menu
Fundamentals
CSS Units
Understand relative (em, rem, %) vs absolute (px) units.
1Absolute vs Relative
Pixels (px) are absolute. REM and EM are relative to font size. Percentages (%) are relative to parent size.
Example Code
div {
font-size: 16px; /* Absolute */
}
p {
font-size: 1.5rem; /* 1.5 x root font size */
width: 50%; /* Half of parent width */
}Finished reading?
Mark this topic as complete to track progress.