Back to Developer Roadmap

Em Vs Rem

src/data/question-groups/frontend/content/em-vs-rem.md

4.0497 B
Original Source

They’re both relative units of measurement, however, they’re relative to different things:

  1. “em” units are relative to the font size of their parent element. So if the parent element has a font size of 20px, then setting a “2em” font size, would equal to 40px.
  2. “rem” units are “root em”, which means they’re relative to the web page’s root element (the “<html>” element).