4 ms·
A little secret opinion of mine is that I think the global usage of rem instead of px is a fad. The only real argument I've heard is that the mobile devices hav
by aliswe 6y ago
A little secret opinion of mine is that I think the global usage of rem instead of px is a fad. The only real argument I've heard is that the mobile devices have their own definition of it, and will thus optimize in their own way, but then again I see that benefit as being nearly non-existant and definitely not demonstrated.
- interactivecode 6y agoMost designs and typography are referenced of a basic unit, the body font size. Setting that size once and using rem makes it easier to build out and change.
- mellow2020 6y agoUsing relative units makes it very easy to scale things. If you use pixels or other absolute units everywhere, you'd have to edit every instance of that, which can range from an annoying chore to being completely unfeasible. https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_...
- partyboat1586 6y agoI just use rem when it needs to be relative to the text size, px everywhere else. This way when you scale the text for accessibility you don't get any clipping.
- rob74 6y agoIt's a fad nowadays, but if you remember the bad old days when the "zoom" function in browsers was useless on most pages, that was because the browsers did it "by the book": they only zoomed elements with relative sizes, px units were always pixels. Then browser makers just gave up and reimplemented the zoom function to work with "broken" pages too (I think Chrome did it first and the rest followed suit). Of course the advent of Hi-DPI screens probably also played a part...
- jFriedensreich 6y agostrongly agree. this article sums the current state up perfectly: https://medium.com/hackernoon/rems-and-ems-and-why-you-probably-dont-need-them-664b9ce1e09f https://medium.com/hackernoon/rems-and-ems-and-why-you-proba...
- runarberg 6y agoThe most relative units are calculated in turns of the font size of the root element (usually 1rem = 16px). I find it a lot easier to read and maintain units that are based on the font-size of the current element (e.g. `em`, `ex`, and `ch`). “This element has block margins 2 times the size of the font”, as opposed to some magic absolute `px` or `rem`. Also if margins and paddings are defined relative to the font-size (e.g `padding: 1ex 1em;`) resizing the entire element with `font-size` is way more manageable.
- symmitchry 6y agoWhen I read that section about rems and ems and ch and px it made me think of Python's "There should be one-- and preferably only one --obvious way to do it." CSS and front-end browser work drives me up the wall.