Posted on May 31, 2024

I am not fan o em unit to give sizes to html content. But unfortunately I have to work with other developers sometimes. So, some of those likes to use em unit but they have no idea how the em works. Yes I don’t have idea until today. So I have to learn the calculation of em.

Let me share with you too.

EM is relative unit to the nearest parent font-size. So, if you use EM, it means, parent font size X em value.

<div style="font-size: 16px">
I am the normal text
    <span style="font-size: 0.9em">Hey I am smaller text</span>

So, the smaller text's font size is `14.4px` 

Still I do not like em units.