No video

Stop Using Pixels/Rems/Percentages To Define Widths In CSS

  Рет қаралды 470,684

Web Dev Simplified

Web Dev Simplified

Күн бұрын

Пікірлер: 220
@jordancutler7552
@jordancutler7552 2 жыл бұрын
Kyle nice short but comon man the title was really clickbaity. Theres no way you are actually recommending to stop using pixels / rem / % for width.
@forkerion
@forkerion 2 жыл бұрын
I think he meant you should stop using that for exact size.
@Al_Gonzo
@Al_Gonzo 2 жыл бұрын
It is clickbaity, this is what KZfaq has become. Dont hate the player, hate the game.
@RodrigoDAgostino
@RodrigoDAgostino 2 жыл бұрын
@@Al_Gonzo who makes what the game is if not the players? :S
@Al_Gonzo
@Al_Gonzo 2 жыл бұрын
@@RodrigoDAgostino the admins? Heads of youtube?
@RodrigoDAgostino
@RodrigoDAgostino 2 жыл бұрын
@@Al_Gonzo do admins or heads of YT put a gun to every youtuber’s head and force them to abide by the click-baity guidelines? Yeah, I didn’t think so
@dagonzalez1757
@dagonzalez1757 2 жыл бұрын
Liked the content, disliked the title
@ibrahimal4342
@ibrahimal4342 2 жыл бұрын
Sad clickbait title. Views over informative titles from an educational channel 🤦‍♂️
@BNewtonUK
@BNewtonUK 2 жыл бұрын
Money && Views > Quality of Information
@sdehh
@sdehh 2 жыл бұрын
@@ibrahimal4342 without this title maybe you would have never seen this video, so its content
@jlee3361
@jlee3361 2 жыл бұрын
designer gives you a layout. kyle: theres no way i can do this anymore
@Elijah_Lopez
@Elijah_Lopez 2 жыл бұрын
Better title: Define widths easily with fit-content
@At1ksh
@At1ksh 11 ай бұрын
Well then u would never click to watch the full short if he did that
@Rami-bi9xj
@Rami-bi9xj 7 күн бұрын
@@At1ksh if i dont label my product that it cures cancer nobody is gonna buy it.
@MuhammadAdamFirdaus
@MuhammadAdamFirdaus 2 жыл бұрын
I like most of your videos because simplicity, straight to the point. But this title of video make me feel intimidated. Kyle, please don’t like the other KZfaqrs who tend to not using existing features and you should do this instead. You just introducing another feature, but it doesn’t mean we need to stop using px, rem, %, etc.
@peter-jb
@peter-jb 2 жыл бұрын
gonna cry?
@moldman5694
@moldman5694 10 ай бұрын
@@peter-jb gonna piss your pants maybe?
@ujirooduokpe8243
@ujirooduokpe8243 2 жыл бұрын
The problem with fit-content, max-content, min-content or auto is that if you want to do animations or transitions on the width or height, it doesn't work.
@dziugazz
@dziugazz 2 жыл бұрын
calc(max-content - 100px) ?
@CottidaeSEA
@CottidaeSEA 2 жыл бұрын
@@dziugazz Using pixels with calculations is pretty bad, as you don't have any context for what the content width is. calc works though, so I'll give you that.
@guillermodanielmazzarigiov1768
@guillermodanielmazzarigiov1768 2 жыл бұрын
@@dziugazz I think it would be better to use calc(max-content - 10%) imo since you don't know the exact size of all screens were you'll website will be displayed
@cedrictheveneau9141
@cedrictheveneau9141 11 ай бұрын
@@CottidaeSEAI agree with the pixels part but doesn’t CSS know the exact width all the time ? We don’t if we don’t inspect it but pretty sure CSS does calculations, no ?
@CottidaeSEA
@CottidaeSEA 11 ай бұрын
@@cedrictheveneau9141 width: 100% depends on parent. If parent has no width, your calculation will be off. Unless things have changed recently, using max-content in calc is not possible either.
@stasbazylevych9981
@stasbazylevych9981 2 жыл бұрын
Also very useful minmax() function. You can set minimum width when content is small and max when it is large.
@flethacker
@flethacker 2 жыл бұрын
i love that guitar intro. it has literally conditioned me to remember all the teachings on this channel and alert my brain for more. You should throw that in prior to these tiny short form videos
@osraneslipy
@osraneslipy 6 ай бұрын
Awesome video. I had been lost in this feature for an incredibly long time. And you explained it perfectly in seconds.🙏
@rhym8882
@rhym8882 2 жыл бұрын
finally straight to the point content
@igorskyflyer
@igorskyflyer 2 жыл бұрын
straight-content 🤣
@beinyourguard
@beinyourguard 2 жыл бұрын
really enjoying these shorts series. straight to the point and really useful
@wally-the-web-dev5142
@wally-the-web-dev5142 2 жыл бұрын
Found that while this is a crazy cool feature it often does not work on IOS devices and safari - still waiting for the browser to unify under one banner… would make front end dev so much easier lol
@andyl9920
@andyl9920 7 ай бұрын
Agreed. I'm struggling with building responsive websites. Media queries are tedious and way too much work.
@aaronwaterman3888
@aaronwaterman3888 2 жыл бұрын
Wow! I stopped using pixels, rem and percentages and now none of my websites scale properly!
@MohsinExperiments
@MohsinExperiments 2 жыл бұрын
Keep making these CSS short videos because they are really useful.
@AICameron
@AICameron 2 жыл бұрын
Really appreciate your content Dev! Always delivered clearly and calmly. Great work my man, please keep this up! 🤝
@TheBumbleCheese
@TheBumbleCheese 2 жыл бұрын
Can you do a video about deploying a MERN App or Hosting in general? Would be awesome. Maybe about AWS.
@TheBumbleCheese
@TheBumbleCheese 2 жыл бұрын
@@mr.darkheart2979 At least nothing helpful or something straight forward. There are some videos about hosting but either they are talking like 50 minutes around the point without explaining the essentials or they present a third party platform which runs the app over their own domain.
@mrs8683
@mrs8683 2 жыл бұрын
@@mr.darkheart2979 Vercel, and Heroku are pretty good 👍🏽
@kemal_ozturk
@kemal_ozturk 2 жыл бұрын
Loving these shorts, super helpful information 😁
@billy8461
@billy8461 10 ай бұрын
fit content is amazing! i use it to center absolute divs all the time
@hiteshsuthar1097
@hiteshsuthar1097 Жыл бұрын
Thanks, you cleared it all in just one short 👍
@MohammadMalan
@MohammadMalan 2 жыл бұрын
PS I really love these shorts that you are making . . . Thank you.
@adrianbrewster8213
@adrianbrewster8213 2 жыл бұрын
I am enjoying these concise vids. You really make the topics simplified. Thank you.
@rafaelalejandrodiazcruz4438
@rafaelalejandrodiazcruz4438 2 жыл бұрын
I NEEDED a short like this!!
@sashaikevich
@sashaikevich 2 жыл бұрын
Nice! I want more of these lesser known css rules
@crim-son
@crim-son 2 жыл бұрын
Awesome content Kyle... Loving the Shorts
@heckyes
@heckyes 2 жыл бұрын
I wasn't sure about your channel when I first subbed. Really glad I did though. I'm a back end dev who only ever does CSS when I can't bribe someone else to do it for me lol. Your videos have been really helpful. I keep putting off learning CSS from scratch cause it's so huge now.
@gourabpaul3560
@gourabpaul3560 2 жыл бұрын
his hairstyle gives it away, tbh he is one of the best webdev teacher on yt
@busyrand
@busyrand 2 жыл бұрын
Thanks for breaking down these new CSS properties.
@CreativeTutorialsWeb
@CreativeTutorialsWeb 2 жыл бұрын
Thanks so much Kyle love the work you put into making videos every one of your videos are a blessing 💙 you too are a blessing 😁
@The-Dev-Ninja
@The-Dev-Ninja 2 жыл бұрын
yes
@CreativeTutorialsWeb
@CreativeTutorialsWeb 2 жыл бұрын
@@The-Dev-Ninja you're a blessing too Happy New Year 💙
@CottidaeSEA
@CottidaeSEA 2 жыл бұрын
I honestly need more examples of when these things would actually be useful, because one of the only cases where I find it useful is for text.
@noblesse3092
@noblesse3092 2 жыл бұрын
Title is kinda misleading but I must admit the content is actually solving a problem I hD
@sanjeevKumar-eg6hp
@sanjeevKumar-eg6hp 2 жыл бұрын
This is will be very useful if your doing responsive design or adding footer
@user-bi2so9dr3t
@user-bi2so9dr3t 11 ай бұрын
very well explained, thanks!
@Gamingworld-17
@Gamingworld-17 2 жыл бұрын
I wanted to lean just some few things in java script but it just so important that I must know it if I really want to be a dev, I wish you post a video on java script full course I will appreciate that am a big fan of your, I watch almost every single video of your I have seen thus far, since mid 2020
@badunius_code
@badunius_code 2 жыл бұрын
So another "Sthap using X" bs I need some child of wrap flex container to take all of its width Which one would it be? Auto? Max? Or maybe, just maybe, a 100%? What if I need children of a flex container to take equal parts disregarding their content? What if I need a fixed table layout?
@ChaoticNeutralMatt
@ChaoticNeutralMatt 2 жыл бұрын
Bad title
@badunius_code
@badunius_code 2 жыл бұрын
@@ChaoticNeutralMatt of course it is. Because when someone is searching for helpful information, rarely they google for "how to stop using percentages in CSS"
@cedrictheveneau9141
@cedrictheveneau9141 11 ай бұрын
For the last point, I’d suggest grid Don’t forget that your tag is in display block by default and uses all the available space… Theoretically you should never have to set a width by yourself as if you use the proper display type everything should be automatically defined Though it takes some time to get the hang of it, I’ll give it a shot at some point to see if it’s actually doable in an actual project
@氷語
@氷語 2 жыл бұрын
I want to understand all of the spacing and ordering of CSS but Idk where to find the best short guides. This video is less than 1 minute and explained a bunch of things regarding content sizes
@thiago670
@thiago670 2 жыл бұрын
I'm not a front-end developer, but I really like to watch his channel videos.
@lyndonmilligan9398
@lyndonmilligan9398 2 жыл бұрын
Thank you, Kyle!! I didn't know what min, max, fit-content is before untill watched this video
@theworldismine7788
@theworldismine7788 Жыл бұрын
Summary: The best is fit and you should use it
@CrazyCodingChannel
@CrazyCodingChannel 2 жыл бұрын
You explain it very cool
@JoeX92
@JoeX92 2 жыл бұрын
Thanks! I always asked myself what was the difference!
@ZelenoJabko
@ZelenoJabko 2 жыл бұрын
Never needed this. Display block and inline-block covers everything I wanted to do
@king_bobby_the_I
@king_bobby_the_I 11 ай бұрын
Great short and all, but the video never explained the title. Could probably change it into something like "Cool CSS Scaling Features"
@kitcat2449
@kitcat2449 9 ай бұрын
Useful example, thankie
@julie4055_
@julie4055_ 2 жыл бұрын
I like using media queries, it might seem tedious to manually define a rem value for each screen size but then everything can look just as you want it to look.
@zeinab_3107
@zeinab_3107 2 жыл бұрын
You're amazing Kyle😍😍🙏🏽🙏🏽🙏🏽
@vicsystems
@vicsystems 2 жыл бұрын
Thanks for this
@patahgaming
@patahgaming Жыл бұрын
Thanks now i know what i have to use
@patahgaming
@patahgaming 9 ай бұрын
What it is?
@erikplachta
@erikplachta 2 жыл бұрын
Appreciate the content, here. Thank you.
@manankataria
@manankataria 2 жыл бұрын
Thank you for this 🙂
@daniedmola7465
@daniedmola7465 2 жыл бұрын
Wow, thanks so much for this
@nicolasmayorga8288
@nicolasmayorga8288 Жыл бұрын
Amazing thanks ❤
@rezarahman1782
@rezarahman1782 2 жыл бұрын
What about image? For example in a portfolio website about section where there is some text and image side by side, it’s very difficult to adjust both column.
@blenderpanzi
@blenderpanzi 10 ай бұрын
Cool, didn't know these! Though caniuse says it's still -moz-fit-content for Firefox.
@aram5642
@aram5642 2 жыл бұрын
For the reaspn shown by max-content they could have provided a :clipped selector
@tresvecesno7071
@tresvecesno7071 7 ай бұрын
Thanks!
@lovenangelo5415
@lovenangelo5415 2 жыл бұрын
Really helpful
@Winner12349
@Winner12349 2 жыл бұрын
Love ♥️and Respect from India 🇮🇳
@BNewtonUK
@BNewtonUK 2 жыл бұрын
*PLEASE* stop using click bait titles to recommend stupid things to people learning to code. Telling up and coming coders that they should completely get rid of certain skills and code from their toolbox is so irresponsible of you. Please, instead, encourage learners to understand the “use case” and pros and cons of each. Absolutely no aspect of coding should be completely disregarded unless the code spec itself deprecates or excludes it.
@viniciusm.m.7822
@viniciusm.m.7822 2 жыл бұрын
Dont know why, but i always need to check if the video speed is ok o.O
@MarteDesignGrahicStudio
@MarteDesignGrahicStudio 2 жыл бұрын
Thanks bro. This helps a lot
@hyperprotagonist
@hyperprotagonist 2 жыл бұрын
You’re telling me that your entire CSS doesn’t contain a single percentage, rem or pixel? Hard to believe.
@harshitjoshi3082
@harshitjoshi3082 2 жыл бұрын
Thanks 👍
@samuelmatheson9655
@samuelmatheson9655 2 жыл бұрын
I'LL NEVER GIVE UP MY REMS
@JasonJA88
@JasonJA88 2 жыл бұрын
Font size based on parent container that's what I want in CSS but for now we have to use JavaScript
@alexg4927
@alexg4927 2 жыл бұрын
What about em units? They are relative to the parent container font size
@cool__name
@cool__name 2 жыл бұрын
Differences between auto and fit-content?
@mikopiko
@mikopiko 2 жыл бұрын
auto takes up all the space while fit-content takes up what's needed I guess.
@it_aint_aayush
@it_aint_aayush 10 ай бұрын
Thanks man!
@azulay7
@azulay7 2 жыл бұрын
The big Q is how to use it with text-overfow: ellipsis?
@thomasjoli-coeur6037
@thomasjoli-coeur6037 2 жыл бұрын
Vw units for the win IMO
@cliffclof
@cliffclof 2 жыл бұрын
Omg, finally found a YT short that is actually useful. I’ve been disliking every short so they get a hint. 👍🏻
@seahmadnailal-darabi8985
@seahmadnailal-darabi8985 6 ай бұрын
good job
@Social_Brat
@Social_Brat Ай бұрын
So fit content will be way better for @media and display?
@sripranav
@sripranav 2 жыл бұрын
Then what's the difference between fit and auto?
@JamesNowland
@JamesNowland Ай бұрын
How’s it different to display: inline-block for fit-content?
@RubberDuckCoding
@RubberDuckCoding 2 жыл бұрын
VERY NICE!
@codewithsheikh2805
@codewithsheikh2805 2 жыл бұрын
Problem with this is it's not supported in all browsers or atleast only new versions support it
@core36
@core36 2 жыл бұрын
But does it work in internet explorer 4?
@CurtisUpshall
@CurtisUpshall 2 жыл бұрын
Is this property well-supported? Last I checked it doesn't work in all contexts
@jonathanandersson5723
@jonathanandersson5723 9 ай бұрын
Hey its the DOOM on potatoes guy!!
@iang9675
@iang9675 2 жыл бұрын
Is it possible to size a parent / sibling element based on the size of a nested child element? I’m implementing a custom drop down menu using ul, li, div, button, and would like the min width of the button that opens the dropdown to be the width of the largest li child.
@colmenasio5542
@colmenasio5542 8 ай бұрын
bro being handsome af
@DanieleManca1983
@DanieleManca1983 10 ай бұрын
Click-baity or not, it is an interesting perspective to take into account.
@WillievanZyl
@WillievanZyl 2 жыл бұрын
Whats the difference between fit and auto?
@MdNaimurRahmanHera
@MdNaimurRahmanHera 2 жыл бұрын
Such a nice video. ❤️🇧🇩
@quaziyadgar
@quaziyadgar 2 жыл бұрын
We need more videos like this
@adarshkhatri993
@adarshkhatri993 Жыл бұрын
How does he made resizable container??
@yadusolparterre
@yadusolparterre 2 жыл бұрын
...so which one should you choose? Why even use the "auto" one?
@sebaba001
@sebaba001 2 жыл бұрын
fit for most cases it looks like, auto is the normal one and you can choose it when you define borders around it so it just fills the center
@samdelamarter4557
@samdelamarter4557 2 жыл бұрын
Is there a way to use this in a table so each column is as wide as it’s widest cell?
@mohamadmohamad4242
@mohamadmohamad4242 2 жыл бұрын
nice video but can you tell me how are you resizing the div?
@badcatdesign
@badcatdesign 2 жыл бұрын
resize: both; overflow: auto;
@firstnamelastname-oy7es
@firstnamelastname-oy7es 11 ай бұрын
He must be using Java script
@TimHoekstra
@TimHoekstra 11 ай бұрын
Any idea how to size a font so that the text always fits on N lines of content?
@guanghuili474
@guanghuili474 Жыл бұрын
how you resize the container with mouse?
@timnelson3431
@timnelson3431 10 ай бұрын
What's the difference between AUTO and FIT content?
@Azmeroth1370
@Azmeroth1370 7 ай бұрын
auto doesn’t work for my canvas for some reason
@vuongqtvn
@vuongqtvn 2 жыл бұрын
Very nice
@alvaroprietovideos
@alvaroprietovideos 2 жыл бұрын
mmmm... so, inline-block elements are fit-content by default?
@josephlivengood4508
@josephlivengood4508 2 жыл бұрын
Can this be used inside a grid div?
@Leyksnal
@Leyksnal 2 жыл бұрын
Please what it we have a container that has two or three more container inside and we just want to do our Display: flex;
@seobookpro
@seobookpro 7 ай бұрын
Is the auto work on all browsers I think there was updates last year that may be fixed it on full
@mridulsetia4974
@mridulsetia4974 2 жыл бұрын
How do we make that resizable text box ?
@wtiy
@wtiy 2 жыл бұрын
how do u control the size of the container?
@annaatitech5908
@annaatitech5908 2 жыл бұрын
I don't think that's gonna end, I'm more of a percentage, I don't it sucks but fixed sized pixels are worst as I think
@DarsoMAN
@DarsoMAN 11 ай бұрын
Fantastic
The problems with viewport units
13:23
Kevin Powell
Рет қаралды 359 М.
These CSS PRO Tips & Tricks Will Blow Your Mind!
8:48
Coding2GO
Рет қаралды 256 М.
Running With Bigger And Bigger Feastables
00:17
MrBeast
Рет қаралды 164 МЛН
🩷🩵VS👿
00:38
ISSEI / いっせい
Рет қаралды 27 МЛН
Blue Food VS Red Food Emoji Mukbang
00:33
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 17 МЛН
Learn Closures In 13 Minutes
13:22
Web Dev Simplified
Рет қаралды 65 М.
Are You Making These CSS Height Mistakes?
8:54
Web Dev Simplified
Рет қаралды 128 М.
CSS Tips And Tricks I Wish I Knew Before
12:12
Lama Dev
Рет қаралды 470 М.
Master CSS Overflow/Text Wrapping Like A Senior Developer
20:53
Web Dev Simplified
Рет қаралды 43 М.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
developedbyed
Рет қаралды 945 М.
Learn Every CSS Selector In 20 Minutes
19:38
Web Dev Simplified
Рет қаралды 447 М.
Use these instead of vh
6:06
Kevin Powell
Рет қаралды 502 М.
WTF Do These Even Mean
13:44
Web Dev Simplified
Рет қаралды 84 М.
Using CSS custom properties like this is a waste
16:12
Kevin Powell
Рет қаралды 168 М.
This Simple Trick Makes Your Website 83% Better Looking
10:57
Web Dev Simplified
Рет қаралды 388 М.
Running With Bigger And Bigger Feastables
00:17
MrBeast
Рет қаралды 164 МЛН