Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Em or REM? #9
It's hard to say if any one single unit (px, em, rem, percent) is better than the others. I think they all have their place depending on the use case, project, and of course personal preference.
That said, the scale is based on percents, just like em and rem units, so the rem value is the same as the displayed em value.
Here's an example:
Here's an example where I could argue using em units is the better approach. If I want to scale an entire sidebar or widget to a smaller size, then by using em units I can just change the font-size instead of changing all the values for fonts, margins, padding, etc.
Here's that same example using rem units. You'll notice that the h2 doesn't inherit the font-size, nor does it affect the padding or margins, so I would have to declare all of that again for my small widget, vs just changing the font-size.
Anyways. I do appreciate the feedback, and it's been a while since I've looked at this project. The text at the bottom might be due for a refresh, and maybe I can incorporate some of this into it; information explaining units, how it can be used for rems, etc.
Ah, thanks for the use case where em are indeed useful. An option to set the unit would indeed be more relevant than my initial suggestion.
I did something quite nice (but unorthodox) thanks to your tool: a typographic scale for mobile, and one for 1024px and above. I'm still fidgeting with it, but in case you want examples: http://plancomptablebelge.be