Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Compounding em is total hell to keep track of in my head, even with a stylesheet open in front of me. I'm not much on top of front-end, but why aren't rem units just better in every way?


If you use em for say the bottom margin on a heading, it is going to be relative to the font size of that heading (if specified).

Where as a rem would always be relative to the root of the document, which is not always the desired effect when it comes to responsive typography.


I'm sure grandparent knows that. The problem with cascadingly using em is that you cannot easily deduce the derived em-value on the nth level (e.g. header > nav > div > a, each with their own em-based font-size; good luck reasoning about a's em-value).


I like em for small exceptions. Likes <small> modifier to make that text smaller than its parent. Exactly the use case where you want a "relative" unit.

Everywhere else, I'll just use pixels.


I thought this as well until I had to use a "widget library" that used REM to style.

If i set the HTML font-size to 16px (the default) the widgets are WAY too big, if it set it to 10px (what they use in their examples) it looks great but everything else is too small.

So I need to either re-style all the widgets (damn near impossible), or set all other elements to 1.6rem...

If they used em, i could just set the container to what I wanted and called it a day.

So em definitely has it's place, but I think the majority misuse it.


They don’t work in IE8. If you’re working on smaller projects that’s less of an issue, but I still get 6 figures of IE8 users per month on mine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: