+ 1

Em or rem?

What is the difference between Em and Rem & which is the best choice?

14th Mar 2017, 7:32 AM
Rateb Özil
Rateb Özil - avatar
3 odpowiedzi
+ 2
<div style="font-size:1.5em"> Some <div style="font-size:1.5em"> Text </div> </div> try it, and then change to rem
14th Mar 2017, 9:02 AM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
+ 2
When using em units, the pixel value you end up with is a multiplication of the font size on the element being styled. When using rem units, the pixel size they translate to depends on the font size of the root element of the page, i.e. the HTML element. That root font size is multiplied by whatever number you’re using with your rem unit.
19th Mar 2017, 7:55 AM
Simpson Chacko
Simpson Chacko - avatar
0
Hi
29th Mar 2023, 6:05 PM
Arman Nasrat
Arman Nasrat - avatar