Design Web Typography Final Project: Create a Typographic Site Basic One and Two Column Layouts

Bryan Thien
Bryan Thien
5,389 Points

Rem or Em

Why does he use rem for max-width but the rest he uses em. Is there a good rule of thumb when to use each one?

2 Answers

Shay Paustovsky
Shay Paustovsky
6,705 Points

Hi Bryan,

I didn't complete the 'Web Typography' course but Guil touches this subject on CSS basics.

The idea is simple:

When you want different font sizes for elements inside a parent element and the parent has a different font size, go with rem because if you use em units then a compounding effect will happen because em units being the relative units they are, are relative to their parent element's font size. If you want to avoid this affect then use rem's

Bryan Thien
Bryan Thien
5,389 Points

So could you just use rem for mostly everything and then use em when you want a different font size? Thank you for answer :)

Shay Paustovsky
Shay Paustovsky
6,705 Points

You will use rem's when you want the font size to be relative to the root of the document. and em's when you want the font-size to be relative to the parent element of the child. that's while assuming you changed the font size of the parent element.