HTML & CSS · Junior · Question 23 of 75
How does rem differ from em?
- ✓Correct answer:
remis relative to<html>'sfont-size,emto the current element'sfont-size - 2
remis pixels adjusted for Retina density,emis ordinary CSS pixels - 3
emis relative to the browser window width,remto the parent element's width
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.