Use this instead of white-space: nowrap

preview_player
Показать описание
white-space: nowrap can come in handy at times, but it introduces the possibility of overflows, but using min-width: fit-content solves the same problem, but will allow text to wrap if there is no more space available.
Рекомендации по теме
Комментарии
Автор

Every time you make a video, I'm like 'alright I've GOTTA REMEMBER THIS DONT FORGET THIS!!!'

astrahcat
Автор

Showed this to a guy at work 3 or 4 years ago as he was using white-space: no-wrap, I've used this technique for a couple different things - most commonly the button situation in the video but also table cells.

fredhair
Автор

Finally a solution for messy tag buttons.

hakeryk
Автор

Brilliant! It's so easy to fall back to old destructive habits. Also this design challenge is really common on the web.

jenstornell
Автор

Definitely have had this problem before, will pull up this video next time I run into it. Thanks!

MuhammadAli-vemt
Автор

Ugggg, I’ve been at it over a decade. Where have you been my whole life, fit-content!

loudboomboom
Автор

That’s a great looking product card. Something about the fonts and the lil effect on the button

KaizenCodes
Автор

Real world css problem 😊😊. Solved. Thanks

Dipenparmar
Автор

straight to the point, excellent advice as usual 👍

blizzy
Автор

Great CSS tip, thanks for sharing it Kevin

webdevluc
Автор

hungry for a full tutorial on this card layout 😊

raymondmichael
Автор

Css is notoriously annoying in cases like these. Thanks Kevin

jonathanjohnson
Автор

little things like that force you to upgrade pc over time, calculations in the backend must be crazy for that

xvoo
Автор

thanks for this great tips kevin. one question : if parent of icon and text have flex-group class why flex-wrap does not working I mean why text is not on new line ?

amirarashi
Автор

thanks for the info, but how do you quickly comment it out or remove the comment like you did?

GRITFUEL-yt
Автор

Oh what the heck, I'm not gonna get a job anyway

keifer
Автор

I tried it on an absolute pseduo element ::before but, it doesn't work. May I ask why this happens?

FurkanKARADENIZ-ttzf
Автор

You deleted a space from the tab so the line was offset after you highlighted and replaced the text XDD

givowo
Автор

What's the difference between this and max-content?

krzysztofprzybylski
Автор

Finally one solution 🥲 This irritates me a lot 😂

ashokreddy
visit shbcf.ru