EM vs REM

Photo by KOBU Agency on Unsplash

EM vs REM

EM

  • if you set a font-size using em it will be in relation to that elements parents
  • 1 em generally default to 16px
  • compounding(It build one on top of each other) - causes problem(font-size)

  • in case of margin and padding it looks at the font-size of the (element)block

image.png

  • super use full for button

REM

  • sole purpose of fixing whole componding problem

image.png

  • look at the Html/root elements font-size

  • more consistent always look at Html/root

  • in case of margin and padding also rem always look at the root (font-size)