HTML & CSS · Junior · Question 23 of 75

How does rem differ from em?

Explanation

rem (root em) is always based on the font-size of <html> (usually 16px), so sizes are predictable. em depends on context and compounds when nested: font-size: 1.2em inside 1.2em gives 1.44 of the base. Window-relative units are vw/vh.

Further reading

Problem with a question

HTML & CSS · Junior · question 23

Test yourself

Take the HTML & CSS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz