educative.io

Educative

Doubt regarding rem usage in Text Alignment in CSS

I am not understanding what is the root element in this rem usage and why the sizes of both small Text, big Texts, normal texts are the same in second casehttps://www.educative.io/module/lesson/css-basics/gxBR4N1yVq9

Hi @Arkoprova_Madhu

When we use em, the size of the font is determined by the font-size value of its parent(it(font-size) will get doubled in the child).

When we user uses rem, the reference point is to the root element(it(font-size) will be the same as in the root element).

.

I’ve attached examples of both before em is used and after that rem is used.

1 Like

Thanks, I get it now.