Тёмный

Why You Should Use REM Instead of Pixels 

Frontend FYI – by Jeroen
Подписаться 20 тыс.
Просмотров 30 тыс.
50% 1

Yesterday I created a lightning speed Short to tell you why using REM instead of pixels is super important: • Why you (almost) alway...
That video however, was a bit too tightly packed with information. So I decided to turn it into a main video, explaining this important topic in way more detail.
Using REM for main sizes like fonts, margins, paddings, etc is very important for accessibility. By using REM instead of pixels, your sizes will all scale when a visually impaired user sets a custom base font for their browser. This way, these people are also able to enjoy the web the way they deserve!
Let me know in the comments as soon as you've implemented it in your own project!
👀 Timestamps
00:00 - Intro
00:38 - Why you've used pixels until now
01:00 - Why pixels are wrong
02:16 - Changing our code to use REM
03:16 - Making your HTML node percentage based
04:16 - Exceptions to using REM
05:08 - How about EM?
07:48 - Outro
💬 Join us on Discord: www.frontend.fyi/discord
🐦 Follow me on Twitter: / frontend_fyi & / jeroenreumkens
👨‍🏫 Check my mentorships: www.jeroenreumkens.nl/mentoring
#css #html #accessibility #frontend #frontendfyi

Наука

Опубликовано:

 

1 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 116   
@jshstuff
@jshstuff Год назад
something I wish was mentioned in the video is media queries. When working in rem layouts, the correct way to do media queries is by using ems for max/min-width queries. Otherwise the media query calculations will be way off when the font is resized, which I have a feeling is a more common thing than people think. I'm just talking about using ems for the @media (min-width: ___ems) {} part, not the rules within the query. These media query properties like min/max-width ignore any font size you've set on the :root/html. ems are sized relative to their parent, so in the case of media queries there is no parent and they therefore get a font size of `medium`, which is usually 16px... even if you've put a :root font size of 62.5%, 14px etc. So things will get crazy if the user has changed their font size preference. Using ems to declare media queries is how to get your layout to act as it should regardless of screen size, zoom setting or font size preference. So let's say you had a media query: @media (min-width: 1024px) {} and wanted to convert it to your rem layout, you would divide 1024px by the typical font size of 16px, making: @media (min-width: 64em) {}. Now things will work as expected all the time, everywhere.
@frontendfyi
@frontendfyi Год назад
You my friend, are amazing 🙏 This comment is so valuable that I’m going to pin it right away. You’re totally right in that this is lacking in my video, and perhaps it is even worth a follow up video. Thank you so much for taking the time to write such an elaborate comment! You my friend deserve a medal 🏅 Would love to connect on Twitter if you’re around there. (My links are in the description).
@dweblinveltz5035
@dweblinveltz5035 Год назад
Awesome comment
@andreagravano5146
@andreagravano5146 Год назад
This is SO VALUABLE. Thank you so much👏🏽
@deniskotov
@deniskotov Год назад
I didn't realize that. Thank you.
@bohdandovhal
@bohdandovhal Год назад
Can we just use rem in @media. What problems await us?
@lesalmin
@lesalmin Год назад
I believe most people I know don't even know they can change the browser default font size. They simply use Ctrl + mouse-scroll-wheel to zoom the whole page if needed.
@frontendfyi
@frontendfyi Год назад
Absolutely true! This mostly applies to visually impaired users. They tend to override this browser config and browse like this all the time, instead of zooming in whenever needed.
@MatiasMeno
@MatiasMeno Год назад
I doubt that's true. Do you have any data to support that?
@frontendfyi
@frontendfyi Год назад
No hard data unfortunately. Rather than talking to multiple people who are blind or could see very badly about how they use the web. But that’s of course n=5 or something like that.
@MatiasMeno
@MatiasMeno Год назад
Fair enough. I wonder why they would do this though. Isn't zooming just the easier and better way of doing this?
@PorcoEspinhoTPX
@PorcoEspinhoTPX Год назад
@Matias Meno I guess using zoom is tab specific, while overriding base font is univelsal
@justinnamilee
@justinnamilee Год назад
I'm basically strictly backend & devops, but it's videos like this that help the little bit of frontend and CSS I end up writing better. Thanks! xD
@frontendfyi
@frontendfyi Год назад
Thanks a lot! Really love reading these comments 🥰 Glad you found my video useful!
@poxen2895
@poxen2895 Год назад
I've been coding for a few years now, and yet I have never known this. Thanks for the recommendation, RU-vid! Great and explanatory video!
@frontendfyi
@frontendfyi Год назад
Thank you so much! This is exactly why I want to make videos like this 🥰 It makes the web better for all of us!
@piwinner
@piwinner Год назад
I have used every approach you mention here for years, except for your suggested one. Will start applying this everywhere. Thank you!
@frontendfyi
@frontendfyi Год назад
Amazing! Let’s make the web a better place together! 👏
@ebebebeb7283
@ebebebeb7283 Год назад
Thanks for making this, it really cleared things up.
@draftermyself
@draftermyself Год назад
Always so amazing and super cool explanaition
@tedspens
@tedspens Год назад
Thank you! I understand the importance of accessablity, but still struggle with the relations between px, em, rem and root font size. Now it makes perfect sense. Now that I know what to do, I have a whole lot of css to update.
@onecornflower
@onecornflower Год назад
Thanks so much! I've been trying to start using rem but I gave up every time because of how cumbersome it was to calculate it. This is a huge game changer.
@frontendfyi
@frontendfyi Год назад
It’s funny that your username is Em 🤣 Good to hear this video was of help to you 🙏
@ben-sterling
@ben-sterling Год назад
Great video. I like using `em` for margin for typography. If I have something like `font-size: clamp(1.6rem, 3vw, 4.8rem)` then I can use `margin-bottom: 0.8em` to keep my spacing consistent. This obviously only works for some types of designs, but can be really useful!
@dabbopabblo
@dabbopabblo Год назад
It can also cause extremely layout breaking issues when users have an unexpectedly large font size for their device with margins taking up most the page. You should always at least clamp the maximum size using a pixel value, but that’s just my opinion
@dabbopabblo
@dabbopabblo Год назад
Here’s what I use for sizing everything on my website: calc(calc(var(-phone-factor) * 10px) + calc(var(-desktop-factor) * 20px) That’s basically saying if it’s on mobile do 10px and if it’s on desktop do 20px, and those factors default to 1 on one based on your user agent but once your browser receives the website some client code adjusts them to fit the displays conditions best. It calculates them by clamped linear interpolation of your screen size compared to a phones screen size and a computers average screen size and using a class on the body past a certain threshold it will change elements styles drastically to adapt to what can be considered definitely a phone screen, allowing for the site to become styled like an app would with different options available like drop downs instead of toolbars
@deniskotov
@deniskotov Год назад
Thank you, very useful!
@jowarnis
@jowarnis Год назад
Great video!
@michaeledwardharris
@michaeledwardharris Год назад
This is excellent. I started adjusting my browser font size when my eyesight started deteriorating I'm my 40s. That changed a lot about how I wrote and understood CSS.
@frontendfyi
@frontendfyi Год назад
Great to hear from someone who is actually using this 🙏 Hope your eyesight isn't too bad ❤️
@marmunator
@marmunator Год назад
Great video like always! However I would recommend a couple things: 1. Don't touch the base font-size because, like people have already commented, its a legacy feature and there are easier ways to deal with calculating px to rem, but I will get to that in point number 2. Before going there tho, I'd like to point out that nowadays many designs follow the "dividable by 4"- format with spacing, where every spacing is dividable by 4. A good example of this is the very common Tailwind and its scaling system: '1': '8px', '2': '12px', '3': '16px', and so on. These scales easily turn into 0.5rem, 0.75rem and 1rem. These are not only easy to remember values, but also super easy to work with and still keep a consistent design going. 2. Okay now to the "Make life easier" portion: There is an extension called "px to rem" by Marco N in VSCode that automatically changes the px to rem with one click so you never have to calculate the values because the plugin does it for you. This is also extra handy when you have values like 243px that calculates to 15.1875rem, which is (in my eyes) a terribly ugly number, so maybe I will round it down to 15rem so its equal to the scaling I'm using. In the end there is really not a THE correct way to code, everyone does how they feel is right for them, these are just my thoughts 🙂
@marcindomanski5654
@marcindomanski5654 Год назад
To make the discussion more interesting, some thoughts for you. On new mobile devices it doesn't matter if you use px/rem/em, because increasing the font increases all units (even px)! I tested this on different phones and different browsers. I myself did not know that the topic has changed so much! It is a well-known recommendation to write the entire page in em/rem, because a user may want to zoom in on the font-size and then they will have zoomed in on the entire page. So why doesn't that user use zoom? After all, the effect will be almost identical. And what about other units. For example ch. What if a user walks around the web, where 99% of the pages are in px and are not susceptible to font-size changes (annual css surveys show that px is the most frequently chosen unit). Then either such a user will use an additional plugin, maybe set himself a default zoom, or use another zoom application. And 99% of the pages will be zoomed, but yours will be zoomed 2x, because you have additionally zoomed him on a font-size basis. Why do people worry so much about the ability to enlarge font-size, but at the same time overlook the fact that the user may want a dark background, serif font, bold text, maybe black text on yellow background etc.? Changes to most of these options are either provided by the browser or additional plug-ins. In my opinion, this is where it should go. Ps. REM/EM are super useful and give us super options. But font-size changes by the user these days doesn't seem to be the most important one.
@pranavpatil5849
@pranavpatil5849 Год назад
Words of wisdom.. Subscribing the channel definitely..
@Vietnamkid1993
@Vietnamkid1993 Год назад
I mean holding ctrl and scroll is faster for zooming because not every site is going to use rem, so kinda fighting a losing battle.
@AM-nm6ts
@AM-nm6ts Год назад
thank you for your pedagogy, !
@betogsmith615
@betogsmith615 Год назад
Useful. thanks for sharing.
@frontendfyi
@frontendfyi Год назад
Thanks a lot for commenting 🙏
@TheMetalMag
@TheMetalMag Год назад
Thank you for this explanation none manage to explain
@philippealexandredeleye4608
You should em for padding (or margin) like wise you can une for example 1em for padding and change the font size of the button in rem them the padding will adapt without changing its size. It’s very useful 👌
@GustvandeWal
@GustvandeWal Год назад
I've been "that guy" on all sorts of forums and blogs where they end up posting some lengthy explanation that goes "NEVER use pixel, ALWAYS use rem!!" You are the first person I see that cuts to the chase and actually distill ALL information down to ONE conclusion: One can change the preferred font-size in the browser and OS, therefore scale those values that SHOULD scale when you change said preferred font-size, with REM and EM. I've seen people argue that you should substitute EVERYTHING for rem. As such, I've seen 0.1rem been used as a substitute for 1px. Their explanations never go beyond "because it scales", or "because a CSS px isn't a physical pixel". Both of which are absolute non-reasons when all you want is a thin border... I'm going to bookmark this one to link to it in those replies of mine. Again, you are the first person to present an objective view and who doesn't add unnecessary details like niche use-cases. Thank you :) 💙💜🧡
@frontendfyi
@frontendfyi Год назад
Thank you so much for your kind words 🥹 This made my day ❤️
@GustvandeWal
@GustvandeWal Год назад
I never post two comments under the same video, but here goes: For those that have started to argue that changing the root font-size is a legacy feature, there's also a thing called maintainability. Should you code your website cleverly with there relative values, and Mr. Big Boss comes and demands all the fonts be bigger, it is YOU that will be happy when you're literally done in a handful of keystrokes. Now add the rem-stuff to your boilerplate and bam, you have the benefits on each and every project going forward.
@frontendfyi
@frontendfyi Год назад
Also 100% true!
@iUmerFarooq
@iUmerFarooq Год назад
You're providing very useful information. Please try to upload more videos. Thank you ❤️ Love from Pakistan ❤️
@frontendfyi
@frontendfyi Год назад
Thanks a lot! Trying my best to upload more frequent 🙏
@merlinmeraldz
@merlinmeraldz Год назад
subscribed, dang this is new to me.
@kapott_
@kapott_ Год назад
Nice! You made this into a full length vid! Loving your work - keep it up. For so many professionals this just "feels natural", but there are very few who can explain the "why" in a way you do. Will use this as my go-to reference video when I see people defining stuff in px, pt etc. 👍
@frontendfyi
@frontendfyi Год назад
Thank you so much for your kind words, really appreciated 🥰🙏
@jshstuff
@jshstuff Год назад
This year I was finally able to implement ems and rems properly on a complete UI rebuild of one of our large production websites. It's so exciting and feels so nice to finally be building on a solid foundation. Seeing things act properly when I resize my browser font size feels great, rather than before where the pixels only played nice with simple browser zooming (ctrl +)
@frontendfyi
@frontendfyi Год назад
Are we real nerds now if we think this is super satisfying? 🤣🙏 I totally feel you. Amazing to hear you were able to pull this off on a large website!
@BodnarchukR
@BodnarchukR Год назад
Browsers use scaling for the page, and as I see from my research, rems rarely being used even on most popular websites, Google included.
@NedumEze
@NedumEze Год назад
Thank you sir for that eye-opener. 🙏. But, for clarity, setting the root font-size to 10px or 62.5%, does not affect the use of units such as vw, vh, cqw, cqh, vmin, vmax, etc.? Does it?
@frontendfyi
@frontendfyi Год назад
Thank you for your kind words! 🙏 And you are correct, it does not impact those values. It is not like it scales your website down to 62.5% - it’s merely a reference your browser uses while interpreting its own standard font size. So all those units will stay the same 😁
@NedumEze
@NedumEze Год назад
@@frontendfyi Deeply grateful, sir.
@pappapez
@pappapez Год назад
Tanks for this clear and to-the-point explanation! Question: Wouldn’t it be easier to use 6.25% on the root element and then use rems as if they were pixels?
@frontendfyi
@frontendfyi Год назад
Someone else suggested this as well. Never thought about it myself actually. I can’t come up with a potential downside to this approach, except that it is a less common pattern. But as long as you and your team have one way of working, this would definitely be a good option too!
@roshanmuhammed404
@roshanmuhammed404 Год назад
Makes sense
@ga_bu_zo_meu
@ga_bu_zo_meu Год назад
I don't agree with the "full rem" approach. Take gutters for example : If gutters is calculated with rem, a bigger font size results in larger gutters ... and tighter elements if the page is constrained by window width. So, the font will be bigger, with smaller spaces for text, resulting to less readable paragraphs. Relative units are importants, but not with a no-brainer "full rem" way in my opinion.
@frontendfyi
@frontendfyi Год назад
I agree. The title might be a bit misleading in that sense. In the video I agree that you shouldn’t use rem for everything and that there’s still a place for px ❤️
@ashuvssut
@ashuvssut Год назад
underrated content!
@frontendfyi
@frontendfyi Год назад
Thank you soooo much 🥹🙏
@alexsergeev3786
@alexsergeev3786 Год назад
Cool video! I've never considered browser font-size settings before, so new day === new knowledge)) But, I would make a comment about cases where using rem is not an option At my work, we are utilizing Browser portal technology where multiple separate "extensions" (separate es6 modules) might be lazy-loaded/unloaded at random time, so if each of them someway redefines or at least assumes a certain value of the base font size and use rem, then it is getting super unconfident to alight them. So, as a summary from me, when you can control the whole site (or widget e.g. in ) using rem is definitely a way (it provides many cool features like the video I'm commenting), but in complex solutions, it might be complicated to align all sources for base the font-size, and maybe using px is a much reliable thing. So, if you struggle to make everything work in complex cases, just use px, it is ok too 😊😊
@frontendfyi
@frontendfyi Год назад
This is totally true! If you don’t have control over the full site, when building for example a plug-in / widget, it definitely makes sense to stick with px 😁
@ZelenoJabko
@ZelenoJabko Год назад
1. Well, now I have to test my layout on many arbitrary font sizes, just in case an user might override it. This will require a ton of additional hacks for the kind of complex UIs that I usually make. 2. I disagree with you, I will always override the root font size in my CSS. Visually impaired users will use "zoom" feature, as they likely need everything bigger, not just fonts. Why would they ONLY want fonts bigger? Makes no sense.
@frontendfyi
@frontendfyi Год назад
Thanks for your reply, really appreciate it! 1. I think it's indeed impossible to test it in all different font sizes. We can do our best to make it work, but for really large font sizes it's indeed simply impossible to have it look just as beautiful as with the sizes the designer defined initially. 2. The only down size for these users who use zoom, is that eventually they will get the mobile version (because media queries trigger when zooming in). Depending in your website that could be a good or a bad thing indeed.
@ZelenoJabko
@ZelenoJabko Год назад
@@frontendfyi I don't use media queries. I serve the mobile version solely on user agent, therefore it is impossible to get mobile site on desktop. It is still the same HTML, except the body has class=mobile.
@DaveCollison
@DaveCollison Год назад
I think your description of EM units is a little off. EM is calculated as a proportion of the current font-size. If the font-size of the current block is 16px, 1em is 16px. It's that simple. Great for creating inline icons using SVGs.
@CRBarchager
@CRBarchager Год назад
Instead of overrideing the standard messurement of the browser I suggest just learning the learn the 16 table. I understand that calculating 10s could be easier for some but calculating in 16s aren't that hard either as you would mostly just have to add 4 (.25) or 8s (0.5) to the base walue so 20px becomes 1.25 rem and 24px becomes 1.5 rem and then 32 (2 rem) and 48 (3 rem). If you're the single developer on the project then by all means do what comes natural to you but as a developer on a team changing standard values in one project and not all just makes it harder do do your job correct as you need to adjust to this change or figure out why sizes aren't behaving as they should.
@thekwoka4707
@thekwoka4707 Год назад
You don't even need to learn a 16 table. You just use rems directly and you don't need any conversions. But yeah, base 16 is better anyway.
@bellabear653
@bellabear653 Год назад
Why don't google Chrome and Firefox change REM instead of PX?
@JurgenBlitz
@JurgenBlitz Год назад
I'm probably not the first one to comment something like this, but-. I've been coding frontend for about 5 years now and I have NEVER taken this into account as much as I should have. Granted, calculating REM values can be a pain, but it does make the site more responsive and way more accessible.
@frontendfyi
@frontendfyi Год назад
Thanks a lot for telling this! 🙏 This is exactly why I’m sharing things like this. Let’s make the web an even more awesome and inclusive place together 🔥 I hope with the base value of 62.5% calculating REM becomes a bit easier ❤️
@jshstuff
@jshstuff Год назад
@@frontendfyi 62.5%!! 🙂
@frontendfyi
@frontendfyi Год назад
Whoops, thanks! I edited my comment. Such an arbitrary value that’s easy to forget 😅
@alantan79
@alantan79 Год назад
But REM values render different sizes in scaling ie. 120dpi, 150dpi while pixels always show the same size. Try setting REM for laptops (150dpi in Windows 10) vs desktops
@frontendfyi
@frontendfyi Год назад
Interesting. I didn’t know this. Will have to try this out when I get my hands on a windows device!
@jethrolarson
@jethrolarson Год назад
So because most websites cannot be relied upon to avoid pixel font sizes i think most users just zoom their browser window
@geno755
@geno755 Год назад
There is an article online that exactly explains why rem ist not necessary in modern browsers - they will account for base sizes automatically by modifying the pixel raster. This is a misconception across the web. Please check this. Also using rem for everything - you’ll have to adjust values with 6 digits to hit a design… 😢
@frontendfyi
@frontendfyi Год назад
Awesome! Do you happen to have the link to this article?
@geno755
@geno755 Год назад
@@frontendfyi Would probably be nice to pin the comment or male another video so that people are aware…
@geno755
@geno755 Год назад
Third try of posting the link: RIP Rem, Viva CSS Reference Pixel. Thats the title. Mindtheshift as wordpress subdomain is the original article.
@Jarrod0067
@Jarrod0067 Год назад
16 is fine. 0.5 = 8, 0.375 = 6, 0.25 = 4. These numbers become second nature and it's a lot less fiddly than doing, say, 1.9rem. Sure that's 19px in your scenario, but it still feels like you'll end up with a million different sizes I declare all of my values in the root. Generally md, lg, xl, sm, xs etc which are calculated off of rem = 16px and can be used anywhere. SASS mixins make life a hell of a lot easier if you go that route, but they're almost obsolete with the proposed CSS changes coming in the next standard
@MrEnsiferum77
@MrEnsiferum77 Год назад
px or ems or rems or whatever, people overall developers don't know css and the site look crap. and mui still using px with spacing option, so really i don't see that for casual user or casual developer px or rems make some sense. I've worked on project with all rems and project all px, and it's the same...
@user-bu6fc2bn1e
@user-bu6fc2bn1e Год назад
If you change 1rem from 16px to 10px, why would you stop here? In this case it would be even easier to just set 1rem = 1px and to use rem as pixel without necessity to divide by ten
@frontendfyi
@frontendfyi Год назад
Hmmm. That’s actually a really interesting thought. Never thought about this 😁 I can not think of any potential downside this might have right now 🤔
@underflowexception
@underflowexception Год назад
What would the % be in this case? I'm sure there's a reason which is why it's not widely talked about.. but I could be wrong.
@jshstuff
@jshstuff Год назад
@@underflowexception root font-size:6.25%
@ianbottomley9303
@ianbottomley9303 Год назад
@@frontendfyi Personally I would stick with 16px, most front end devs are used to the standard and are happy working in fractions of 16. It makes sense to use 16 as it can be divided nicely 2,4 and 8. 10 can only be divided by 2 and 5
@frontendfyi
@frontendfyi Год назад
Definitely a valid point. Personally I find it hard to quickly calculate 18px in rem when the base value is 16. So that’s why I opt for 10 pixels. But at the end of the day it’s most of the time only a one time configuration in some sort of theme file. After that you’re only using spacing variables. So it could be a problem that is easy to overcome.
@yoloopen
@yoloopen Год назад
But what about google search using pixels? Why visually impaired can scale it up, but they cannot do that for your site?
@frontendfyi
@frontendfyi Год назад
To be honest, I wouldn't look at Google Search for any best practices in frontend 😬 Their website isn't even responsive.. They probably have good reasons for it (speed I think, sending less CSS). But in general they don't really implement best practices on that page. It's all super optimised for conversion.
@yoloopen
@yoloopen Год назад
@@frontendfyi well yes, they have good reasons for it, sending less CSS, just as you said, instead of one big CSS with media queries. I think that people can just ctrl+, and it is not a bad practice because we have a google search as an example of site that everyone uses and it's not causing problems for people. px are much easier for developer, we can proceed faster with px and keep less calculations and less decisions in mind for when to use what, and people just use ctrl+ when they need it, or set default zoom just as well as they can change the base font size
@yoloopen
@yoloopen Год назад
@@frontendfyi but you're right for not peeking at Google Search for best practices, I looked deeper and they indeed keep it non-optimized, lighthouse gives ~80%, and CSS is loaded as a part of other request so it's not even cached
@sgmvideos5175
@sgmvideos5175 Год назад
I prefere vw and vh, or in rare cases % over both px and others
@frontendfyi
@frontendfyi Год назад
Would you also set paddings, margins and font-sizes in any of those units?
@sgmvideos5175
@sgmvideos5175 Год назад
yea, it takes more work, but the page than looks in right size no matter window size, of course used with media
@Grishopping
@Grishopping Год назад
discord ????
@frontendfyi
@frontendfyi Год назад
Soon 👀
@Grishopping
@Grishopping Год назад
@@frontendfyi excellent, I'll be very attentive... thanks for answering... greetings from Venezuela... despite the difficulty of the language, but with the translator and your excellent explanation I'm understanding your videos... att. Jose Grillo español excelente, estare muy pendiente....gracias por responder... saludos desde Venezuela..... a pesar de la dificultad del idioma, pero con el traductor y tu excelente explicacion voy entendiendo tus videos.. att. Jose Grillo
@Disorrder
@Disorrder Год назад
just press ctrl + to scale UI. nobody even know about this setting should I test my UI in multiple root fornt sizes? It's complicated. What if a new browser appear with another default font size? Nonono, please, don't confuse devs
@supermagario
@supermagario Год назад
What if I want to make website for people with eyes? Like making a website is already a huge waste of money, and by caring about font size you just wasting your time for the less than 1% users of the web. That's just stupid.
@frontendfyi
@frontendfyi Год назад
Imagine your sight was very bad. Wouldn’t you feel appreciated if you could still use the web?
@supermagario
@supermagario Год назад
@@frontendfyi I would just use the zoom function of the browser to be honest.
@Emka877
@Emka877 Год назад
Losing my pixels religion
@adisonmasih
@adisonmasih Год назад
use tailwind
@thekwoka4707
@thekwoka4707 Год назад
This is such bad advice. Just learn rems. Don't fuck up standards by changing a rem to be smaller. You don't need pixels. You just use rem. There is no calculation you need to do.
@hojdog
@hojdog Год назад
Stop using css, use tailwind instead
@frontendfyi
@frontendfyi Год назад
Definitely use tailwind, check my other videos 😉 But having basic knowledge of css is super important. Never solely rely on a framework or library - know how (and why!) it works behind the scene.
@hojdog
@hojdog Год назад
@@frontendfyi I agree I'm just being a smartass 😉
@manishpanchal1098
@manishpanchal1098 Год назад
nice video
Далее
Please stop using px for font-size.
15:18
Просмотров 70 тыс.
The problems with viewport units
13:23
Просмотров 357 тыс.
How the PROS Use Tailwind
9:55
Просмотров 46 тыс.
The fastest way to ruin your entire life
6:56
Просмотров 5 млн
Tailwind CSS V4 is SO Good!
8:51
Просмотров 33 тыс.
px vs rem: what to use for font-size in your CSS
16:11
Naming Things in Code
7:25
Просмотров 2 млн