why does tailwind use rem instead of em?

Basically the title. This is mostly just out of curiosity but im trying to make my existing webapp (that was written for desktop) mobile friendly and it seems like its going to be a lot of work to add className="text-lg :lg:text-xl xl:text-3xl" all over my code
20 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
SuplenC
SuplenC2y ago
It's better to generally not use em, and use rem instead because sometimes it might cause undesired behaviour. That's why either bootstrap and tailwind uses it and it's generally recommended to use it.
Tom
TomOP2y ago
ok. ive seem some conflicting stuff online somethings say you can just use em and font sizes are kinda responsive without much work but it was definitely confusing is there a source somewhere on why its bad practice?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tom
TomOP2y ago
that makes a lot of sense is the book worth it? i was considering getting it
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tom
TomOP2y ago
ok. thanks. that quote alone clears up a lot thanks
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
SuplenC
SuplenC2y ago
Yes absolutely. Highly recommended.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
SuplenC
SuplenC2y ago
clamp is good if you are going for just css. If you are using Tailwind if you have repeating same text sizes for each h1 up to h6 you can use @apply
Tom
TomOP2y ago
that seems good. kinda not how tailwind works... this is my first project with tailwind. it makes a lot of stuff so much faster to write and think about, but it definitely seems limitting too @SuplenC oh ok. ill have to look into that
SuplenC
SuplenC2y ago
there is a good video from fireship that shows most of the tailwind features: https://www.youtube.com/watch?v=pfaSUYaSgRo
Fireship
YouTube
Ultimate Tailwind CSS Tutorial // Build a Discord-inspired Animated...
Learn the basics of Tailwind CSS by building a Discord-inspired navbar from scratch. Learn how to leverage utility classes to build responsive animated UI elements faster https://fireship.io/lessons/tailwind-tutorial/ #webdev #css #tutorial 🔗 Resources Tailwind Docs https://tailwindcss.com/ Tailwind React Setup https://tailwindcss.com/docs/gu...
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tom
TomOP2y ago
thats true too
SuplenC
SuplenC2y ago
true but not the nicest solution. The config one is the best at that point
Tom
TomOP2y ago
i like the idea of having a file with all my common font sizes on all the screen sizes though and then just using text-h1
SuplenC
SuplenC2y ago
all possible with either in config or @apply
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tom
TomOP2y ago
got it ty guys a lot
Want results from more Discord servers?
Add your server