Intermediate
HTML & CSS
Q50 / 100
What is the difference between "em" and "rem" units in CSS?
Correct! Well done.
Incorrect.
The correct answer is B) "em" is relative to the font-size of the element's parent (and can compound across nested elements), while "rem" is always relative to the root <html> element's font-size, avoiding compounding
B
Correct Answer
"em" is relative to the font-size of the element's parent (and can compound across nested elements), while "rem" is always relative to the root <html> element's font-size, avoiding compounding
Explanation
Because "em" is relative to the parent's font-size, nested elements using "em" can compound unpredictably; "rem" always refers to the root font-size, providing more predictable scaling.
Progress
50/100