Oh lord... That Twitter thread has so much misinformation.
There is no reason to exclusively use rem over em. In fact, what you usually want is em because an element's padding and margins are 100% dependent on that element's own size. Elements with larger text will need to scale their spacing accordingly. Good luck doing that with rem if you ever need to change an element's font size.
em allows you to style local regions of a page with greater ease. rem always resets you back to the root font size. This is annoying (see #1).
Both em and rem can be used for responsive typography. I saw this point come up a lot, where people argue that rem is better. No—no it's not. There's no difference. As long as you use ems consistently from top to bottom, your UI will still scale, just as it would with rem.
rem and em both have their uses. There's no reason to choose one over the other exclusively, though I find myself using em far more often (#1-3).
Yup! I still use pixels for borders and border radii. I also use them for media queries, though it really depends on where the breakpoint falls. If it falls within a screen width where my font is still scaling up/down responsively between two extremes that I've set up, then I'll use pixels to be more precise.
Oh lord... That Twitter thread has so much misinformation.
There is no reason to exclusively use
rem
overem
. In fact, what you usually want isem
because an element's padding and margins are 100% dependent on that element's own size. Elements with larger text will need to scale their spacing accordingly. Good luck doing that withrem
if you ever need to change an element's font size.em
allows you to style local regions of a page with greater ease.rem
always resets you back to the root font size. This is annoying (see #1).Both
em
andrem
can be used for responsive typography. I saw this point come up a lot, where people argue thatrem
is better. No—no it's not. There's no difference. As long as you useem
s consistently from top to bottom, your UI will still scale, just as it would withrem
.rem
andem
both have their uses. There's no reason to choose one over the other exclusively, though I find myself usingem
far more often (#1-3).I don't think that's the point, it's more about using rem or em, I personally use rem, but em would work just as well.
I do thank you for this detailed explanation, wasn't aware of these points in rem vs em.
So is there any case that you still use pixels?
(Media-queries/borders?)
Yup! I still use pixels for borders and border radii. I also use them for media queries, though it really depends on where the breakpoint falls. If it falls within a screen width where my font is still scaling up/down responsively between two extremes that I've set up, then I'll use pixels to be more precise.
Oke makes sense yes!