3 ms·
The main issue I have with either of them, is sometimes having to resort to using crazy values like 15.974rem or 2.0736rem (taken directly from the author's web
by bbx 11y ago
The main issue I have with either of them, is sometimes having to resort to using crazy values like 15.974rem or 2.0736rem (taken directly from the author's website). Using pixels shouldn't be frowned upon, considering all the preprocessors available, and how CSS variables (the next big thing) are around the corner.
But I would always use EMs for any WYSIWYG generated value, where the design solely relies on HTML tags, not CSS classes. It's then easy to alter the container's font-size while maintaining consistency and balance between all its children.
For borders, in any case, it's better to stick with pixels. Some people started writing things like "border: 0.065rem solid #ccc", which would make the border disappear if you either zoomed out, or set the font-size to something smaller than 16px.
- evolve2k 11y agoAfter leveling up on typography and what it takes to define a nice typographic grid I found REMs to be a revelation. A key concept of good typographic grid design is that the body copy line height (or font size as a proxy) is a very important measurement to be reused across your grid. TLDR; By using your body font size as a basic unit of measure for other visible distances eg padding, margins it's possibly to make your design look better and feel more unified. My crude rule of thumb for beginners is to use REM for everything by default and then change over to EM anywhere this is not working for you (and this is a crude summary of key advice in this article) One style guide I read suggested that pixels were ok for anything up to 5px and that REM/EM should always be used otherwise (towards ensuring a nice typographic grid) and I think that's a good practical approach. If you're essentially thinking in REMs and just translating that to px in certain circumstances to get around crazy numbers, great,if that works for you. But I think that generally REMs provide free design benefits for those that switch to them rather than adding arbitrary non-proportional pixels lengths everywhere within a design.