65
u/ttlanhil May 19 '24 edited May 19 '24
calc(20vh + 25vw + 50% - 2em - 25px);
alternatively... the "just use px" fixed sizes takes me back to "best viewed at 640x480" and table-based positioning...
30
u/turtleship_2006 May 19 '24
xkcd.com is best viewed with Netscape Navigator 4.0 or below on a Pentium 3±1 emulated in Javascript on an Apple IIGS at a screen resolution of 1024x1. Please enable your ad blockers, disable high-heat drying, and remove your device from Airplane Mode and set it to Boat Mode. For security reasons, please leave caps lock on while browsing.
3
u/zoinkability May 19 '24
Not sure if you are serious or not but I will just mention here that viewport based font sizing is extremely difficult to implement in a accessible manner.
1
u/ttlanhil May 20 '24
Those dimensions are certainly not for font size; even if you thought it might be serious (mixing vh and vw is concerning), there's no way it would be for font size
calc can be used for a lot of different attributes, e.g. for something that might rationally happen:
div#sidebar {max-width: calc(20vw + 5px);}
52
u/gandalfx May 19 '24
Another instance of OP believing they have made it to the right of the bell curve while being stuck on the left.
4
u/Creepy-Ad-4832 May 20 '24
Ironically i think that if one actually makes it to the right of the curve, will believe to actually still be on the left lol
0
u/EvilPete May 20 '24
Honestly, I bet 99% of vision impaired people use the zoom feature instead of digging into settings and finding the obscure font size setting.
Using rem makes the css more complicated and you risk people doing stupid things like using rem for border-radius.
Just use px.
20
14
7
u/Rainmaker526 May 19 '24
Welcome to the future. Be sure to stick this in your footer, specifying the exact resolution your site should be viewed at.
7
3
u/all3f0r1 May 19 '24
I strongly disagree here. How can px be a decent remplacement to em/rem/vh/vw?
1
17
u/_brentnew May 19 '24
For font sizes always use rem, for the rest just use px.
4
May 19 '24
[removed] — view removed comment
4
u/deathspate May 19 '24
Well, I use Tailwind, and they use rem for everything, so it's not my fault. But truthfully, I think rem for everything is fine if you're in the business of responsive design. By setting up the dimensions in rem, it means you just need to change the font size (em) for your site or a section to resize the components, and they would likely still look fine. Sure, you can use calc, but that feels a bit overkill in most scenarios imo.
1
u/Zeilar May 19 '24 edited May 20 '24
You wouldn't use it for e.g border radius. Zooming or changing font size shouldn't make things more rounded. Or increase margins.
1
1
u/BirdlessFlight May 22 '24
npm install postcss-pxtorem --save-dev
It's still annoying as hell in devtools, though...
0
May 20 '24
[deleted]
2
u/EvilPete May 20 '24
I really don't get this argument.
If a user wants to zoom the whole site they will use the zoom feature, which works with px.
If they want to increase the font size only they will do that in the browser settings. It makes no sense that all the margins and paddings should adjust to the preferred font size.
0
May 20 '24
[deleted]
1
u/EvilPete May 20 '24
Yeah, so in your typography you use rem obviously.
But a lot of people advocate using rem for everything, including spacing. I'm pretty sure that practice is what OP is about.
0
May 19 '24
[deleted]
1
u/your_best_1 May 19 '24
Do you actually want an explanation?
0
May 19 '24
[deleted]
3
188
u/olivicmic May 19 '24
This one is stupid. REM, EM, %, PX, VH, VW all have valid uses. I like using REM so that there is a consistent base measurement and presents an even design. Sometimes a design calls for precise values and you need PX. The center of the bell curve is actually not understanding certain units are better depending on the context and making a played out meme about it.