This is Why CSS is so Frustrating! 😭

  Рет қаралды 229,818

Dave Gray

Dave Gray

Күн бұрын

CSS has many quirks, and this is just one example that seems illogical. After we get the height of the window we want with flex-grow, we shouldn't have to set another arbitrary height value... but we do because we can't overflow the window if we haven't set a height. And then flex-grow overrides the set height and fills up the window. It's definitely not straightforward.
💖 Support me on Patreon ➜ / davegray
💻 Web Dev Roadmap for Beginners (Free!): bit.ly/DaveGra...
🚀 Discord ➜ / discord
👇 Follow Me On Social Media:
GitHub: github.com/git...
X: / yesdavidgray
LinkedIn: / davidagray
Blog: www.davegray.c...

Пікірлер: 373
@MrHellmager
@MrHellmager 5 ай бұрын
Css heights somehow are one the of the easiest and most frustrating properties.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Agreed!
@saiphaneeshk.h.5482
@saiphaneeshk.h.5482 5 ай бұрын
Yup, it's a blessing and a curse at the same time.
@manjunatha5a
@manjunatha5a 5 ай бұрын
True that!
@gm42069
@gm42069 4 ай бұрын
espcially when you're using padding instead of height which logically would make more sense. LOL this dude filling everyone with misinformation
@jamsheed5179
@jamsheed5179 4 ай бұрын
So it's not only me 😂
@ramondewilde05
@ramondewilde05 4 ай бұрын
Honestly it kind of makes sense Without a set height there is no way for the browser to know where to start the overflow even with flex grow it wont know where to start the grow so it just fits the text content instead which wouldn't have a scrollbar because nothing is overflowing
@Ruin-kf4wl
@Ruin-kf4wl 4 күн бұрын
NO WAY, ive always thought that i would have no manually set the heights for ALL the breakpoints! I cant believe that this is the first time that im hearing about this
@nustaniel
@nustaniel 3 ай бұрын
Makes perfect sense to me. If you don't specify a height on the parent or the child, it will let the element grow to the content inside the element box. That's what HTML elements are supposed to do after all, and without direction, how does it know how big is too big? I don't think I see a max height on the container, so how would it know when to stop growing? Apply a max-height to it and it will stop growing at a specified height and apply the overflow-y: auto. Also using an unordered list for a chat window is an interesting choice 😀
@DoUrden09
@DoUrden09 5 ай бұрын
Because you don’t get it doesn’t mean it defies logic. It literally is logic behind the scene. You want something impossible and expect it to be. You can’t have something overflow if it has no idea how tall it is to begin with. You tell him first to grow dynamically has much as possible, which it does, and then you expect it to magically know that you want it to be static and not dynamic. It can’t know how to place a scroll bar if you just said you want it to grow as big as possible. Hence why that work once you assign an actual height. It can’t just automagically know everything the programmer wants on a given axis that can theoretically be infinite.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
You're making an incorrect assumption. I do get it and even show in the video a height must be applied. This is about why it can be frustrating as the title clearly states. It is an opinion, and some will disagree. I do feel like it is illogical to require an explicit arbitrary height value that will not be used when I have implicitly said I want a height with flex-grow. I wish flex-grow in a column context already applied a height.
@Nellak2011
@Nellak2011 5 ай бұрын
You have to set a definite height obviously
@evolutionxbox
@evolutionxbox 5 ай бұрын
You need to use flex basis and flex grow properties.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Hmm, in the video I show I used flex-grow. The fix that I also show is to use a height value. Not trying to solve a problem here - just showing why it can be frustrating.
@rafaelbarbosa3030
@rafaelbarbosa3030 Ай бұрын
thank you dawg keep the good content 💯💯💯
@babblebey
@babblebey 5 ай бұрын
Great 😁... I'm working on side-by-side editor-preview markdown editor and I have this issue, I just found this randomly scrolling and it was a fix to the issue that's I've just left for weeks 🤤
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Glad it helped!
@SystemDesignNepal
@SystemDesignNepal 5 ай бұрын
I don't think your situation is illogical but yes no doubt it's frustrating dealing with heights even with simple cards or section anything. Width can be dynamic but height we need to think alot. At your situation it's not illogical. Give it vh with calc or svh, dvh.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
It's an opinion so you may not think it is illogical and yet I still can. It's a hypothetical situation that I displayed in video format. I show the fix by applying a height. However, to me it does feel illogical to require an explicit arbitrary height value that will be overridden anyway. In the column context, it would be nice if flex grow would implicitly apply this meaningless height value.
@_insanebuddy
@_insanebuddy 4 ай бұрын
This is not wierd. As, by default, the height is set to 100% of the whole screen. And, on applying overflow-y-auto, it though applies but could not see the data flow out of the div as the div is growing around the height. So, overflow works when there is fixed size values applied to div that specifies the div to be restricted in size and data overflow is controlled with the overflow property.
@noobweaver
@noobweaver 5 ай бұрын
What would you have expected to happen? Flex grow increases the height to the content. You need to define a view port. I think it's straight forward.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
It's an opinion and opinions do vary. To answer your question.. I show the path that leads to confusion as some think they have applied a height and visually it seems as if you have. It feels illogical to apply an explicit arbitrary height value that won't be used because flex-grow overrides it anyway. In a column context, it would be nice if flex-grow implicitly applied this meaningless height value.
@rlyehdate
@rlyehdate 3 ай бұрын
What I hate about css is its non intuitive logic. Doesn't matter how much time I pass doing it. A couple of weeks is enough for me re studying the thing. That does not happen with the programming languages: their logic and syntax makes them self explanatory, not the case for css.
@Tijdperkzuid
@Tijdperkzuid 4 ай бұрын
Tailwind sucks, its basically inline styling, but in the class tag instead of style tag
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
Opinions vary, but there's nothing wrong with Tailwind. As you said, it just applies classes. And by reading what classes are used when it compiles, it keeps CSS bloat down.
@Tijdperkzuid
@Tijdperkzuid 4 ай бұрын
@@DaveGrayTeachesCode Meh, its adding a class for each small style, its almost as adding inline styling, making any code look ugly and messy
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
@@Tijdperkzuid you can use TailwindFold to hide the classes if you want. CSS applies classes in the same way, but to each their own.
@HampusAhlgren
@HampusAhlgren 5 ай бұрын
God that tailwind code is so messy 🤮
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Yeah not everyone likes tailwind but many do.
@AaronLyNxAI
@AaronLyNxAI 5 ай бұрын
Can confirm. Making a layout for a HTML clicker game can take a while when the only coding lessons you've had are bits and pieces you pick up now and again. It's going well however, even with the setbacks due to css.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
The more you use it, the easier it will get. But at times it can still be very frustrating!
@lordpain007
@lordpain007 4 ай бұрын
as a backend dev ...i have cry in rhe bathroom to code the mess of css :( .. dosnt matter which framework or theme i used end of the its css
@dakoderii4221
@dakoderii4221 5 ай бұрын
Excellent editing. The video flows back into itself.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Glad you liked it!
@deadlock107
@deadlock107 5 ай бұрын
Nice trick! Didn't know about that.
@pyromagne2280
@pyromagne2280 5 ай бұрын
What? This is literally my problem yesterday, every time I have a css problem I accidentally getting the answer with your shorts, this happened twice now, well thank you I guest? 😂
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
😆 You're welcome!
@layerok315
@layerok315 4 ай бұрын
The same applies to the horizontal scroll container. You need to set the minimum width to the container to fix this. I also couldn't understand this, so I agree with the author, but it is too late to fix flex
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
Sounds like we both do understand it. I just disagree with how CSS handles it.
@yeetmcgee8734
@yeetmcgee8734 18 күн бұрын
CSS makes me want to only do backend development
@AlexanderBelov-y8o
@AlexanderBelov-y8o 5 ай бұрын
I always add the height to the element, not the container. I've never had this happen to me. I am using grid very frequently, which allows me to control all elements from just the container if that makes sense.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Yes, you need to apply a height. However, it feels illogical to require an explicit arbitrary height value I won't use after I have implicitly said I want a height with flex-grow. It would be nice if flex-grow in a column context applied this meaningless value automatically.
@TheSergy12
@TheSergy12 5 ай бұрын
For flex i always set min-width:0 to all > *. Same for height if its flex column
@Life4YourGames
@Life4YourGames 5 ай бұрын
That's just like you can't animate on auto-values.
@parlor3115
@parlor3115 6 күн бұрын
I guess they could have made it so that the height is automatically the remaining height until the end of the browser window, but it is nonetheless a sensible behaviour imho.
@JawsoneJason
@JawsoneJason 4 ай бұрын
It defies logic when you dont understand how flexbox works 🙄 Studying CSS helps
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
No, I know how it works. I even show what to do in the video to fix the issue. Doesn't mean I don't have empathy for those that it frustrates. And I do think in a column context, flex-grow should imply the meaningless height value that it will override anyway.
3 ай бұрын
All frameworks are frustrating, pure CSS is a pleasure.
@NiNgem-bb6lc
@NiNgem-bb6lc 4 ай бұрын
Hahahah I know this one, only because I had a problem triggering the onscroll event. Even though my body had a scroll the event wasn't triggering. Drop a height and voila.
@alilawati87
@alilawati87 5 ай бұрын
I wasted hours and hours trying to figure out why the scroll bar does not appear!!Thanks
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
You're welcome!
@CristianKirk
@CristianKirk 5 ай бұрын
100% skill issue.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Actually, no. I show you need to set a height value. This video is about why CSS can be frustrating. In my opinion, it does feel illogical to require an explicit arbitrary height value when I am already implicitly saying I want height by applying flex grow in a flex column context. In this context, I wish flex grow would already apply this meaningless height value.
@joshuagalit6936
@joshuagalit6936 7 күн бұрын
Set the min height and height and then overflow y auto
@TheScriptPunk
@TheScriptPunk 4 ай бұрын
People should stop avoiding css. Learn a11y and 508 compliance with site elements. Learn what css can do, and build. It's not hard, people just dont like typing that weird frankenjson syntax and have some affinity to tailwind or bootstrap when they have no idea how their frameworks operate or what the internals are even doing in their projects.
@911Salvage
@911Salvage 3 ай бұрын
I sure am glad I'm not a Web dev.
@zettadam
@zettadam 5 ай бұрын
Having to add height (or flex) is the most logical thing... nothing should be frustrating about that.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I figured there would be some disagreement here. I feel like I already inferred I wanted height by adding flex-grow. It seems illogical to need to go back and add an explicit arbitrary height value.
@renemonroy214
@renemonroy214 Ай бұрын
There’s nothing magical there, it’s just temporal ignorance of a part of the specifications. Everything has a why.
@HikaruAkitsuki
@HikaruAkitsuki 5 ай бұрын
Web design from scratch is the whole thing is frustrating.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
It can be but I love the challenge!
@mohamedalkhyat3284
@mohamedalkhyat3284 5 ай бұрын
Not frustrating but the language needs to know the height that should start apply auto scroll at
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Frustrating is a feeling or opinion so it varies by person. I do apply a height to show the fix. That said, it feels illogical to require an explicit arbitrary height value that won't be used. It would be nice if flex grow in the column context implicitly applied this meaningless height value that it will override anyway.
@0xtz_
@0xtz_ 5 ай бұрын
now I know why it's never working 😢 u saved me
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Glad I could help!
@philipm1896
@philipm1896 5 ай бұрын
Javascript, css, and php are the most popular, proving humans are mostly idiotic and its too late now because people tried to make them better later on and with tooling and now we are in to deep to back out now and keep patching or create new tooling to overcome the stupid.
@erikjunior3643
@erikjunior3643 5 ай бұрын
i wish i could understand that
@marcodelpercio
@marcodelpercio 5 ай бұрын
Why is it strange? You don't even need tailwind for this. Overflow-y implies you declare the max size of y a.k.a. max height of your content, after which the overflow handles it. That's normal
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
Never said you needed Tailwind. I just happened to be using it in this example. Why is it strange? Opinions vary, but I've been asked this one many times. If you don't know to apply the height value first - which will be overriden by flex-grow anyway in this column context - you will have what you see here. At first, CSS applies the flex-grow and the chat window takes up the available space. Visually, it does what you want. And then you add overflow and it blows up. You need that meaningless arbitrary height value for overflow to work. Doesn't matter what the height value is because flex-grow overrides it. In the column context, flex-grow should just imply this value.
@marcodelpercio
@marcodelpercio 4 ай бұрын
@@DaveGrayTeachesCode I think what you were actually trying to achieve for your chat container element is height 100vh, you don't need flex-grow at all.
@danielkoudela1747
@danielkoudela1747 4 ай бұрын
Bro talks like AI.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
Not even close
@danielkoudela1747
@danielkoudela1747 4 ай бұрын
@@DaveGrayTeachesCode That's what AI whould said.
@mohammadmira1626
@mohammadmira1626 5 ай бұрын
that is why i am not a frontend dev
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
The struggle is real!
@S-we2gp
@S-we2gp 5 ай бұрын
html/css/javascript is the biggest pile of garbage on earth. We honestly just need to try again lmao. We're at a local minima we're stuck on the ss sunk bias and none of you will jump off
@arxci9402
@arxci9402 5 ай бұрын
Just use grid...
@tacticalassaultanteater9678
@tacticalassaultanteater9678 5 ай бұрын
Use flex: 1 1 auto
@guseynismayylov1945
@guseynismayylov1945 5 ай бұрын
tailwind looks so shitty
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
It's just CSS classes. You can use the Tailwind Fold extension to hide them when you don't need to see them.
@guseynismayylov1945
@guseynismayylov1945 5 ай бұрын
@@DaveGrayTeachesCode No, it's not just css classes, because it precompiles everything. It's so insane to me that people forgot that there are some decent libraries that allow you to not use css classes at all, and allowing to achieve consistent design.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
@@guseynismayylov1945 I know it compiles. We can nitpick, but essentially, I am applying a class in tailwind that applies a CSS style. It's also customizable if needed. I know some don't like it. Many do. YMMV
@anandv1391
@anandv1391 4 ай бұрын
Css is fun dave
@amansarma417
@amansarma417 5 ай бұрын
So true
@henriquematias1986
@henriquematias1986 5 ай бұрын
terrible i want to be as distant from CSS as possible : D
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Backend development it is!
@frostydog860
@frostydog860 5 ай бұрын
🤯
@whalecoding
@whalecoding 4 ай бұрын
Font ide ?
@younes-47
@younes-47 5 ай бұрын
The thing about css is that nobody is considered master in css 😂
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I agree!
@heracraft5526
@heracraft5526 5 ай бұрын
Kevin Powell
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
@@heracraft5526 if there is a master, it's Kevin!
@zenatimohammedel-amine6646
@zenatimohammedel-amine6646 5 ай бұрын
Of course there's people at that level
@user-il9qo4qc4n
@user-il9qo4qc4n 5 ай бұрын
I'm a CSS master. Only took ten years.
@cyrilgorrieri
@cyrilgorrieri 5 ай бұрын
That's because of the way flex works. It starts with the size of the content and then changes the size based on the rules. In that case the text was huge so it started with a huge box, and nothing to grow. When the height is set, the layout starts with a 4px block and then grows it. There are plenty well explained resources on flexbox.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I knew some would disagree. I know how it works and show you need to apply a height. However, it feels illogical to require explicitly applying an arbitrary height value I won't use after I have implicitly said I want a height with flex-grow. It would be nice if flex-grow in a column context applied this meaningless value automatically. Some will agree and some won't.
@derbaum314
@derbaum314 5 ай бұрын
​@@DaveGrayTeachesCodeWouldn't "flex-base: 0" also solve the problem and be less confusing? I mean it's still kind of weird, but at least looks more coherent.
@cyrilgorrieri
@cyrilgorrieri 5 ай бұрын
@DaveGrayTeachesCode I can see how it could be confusing at first. However, after a short deep dive into flex boxes and how it adapts the layout works from the flex basis, it is no longer confusing and makes all the sense in my opinion.
@dabbopabblo
@dabbopabblo 5 ай бұрын
@@DaveGrayTeachesCodeit’s not a meaningless value though because the presence of a height property or not, has a meaningful effect on how the element is rendered. The moment you take the css specs implementation into account, is the moment the behaviour becomes intuitive.
@callmepotato192
@callmepotato192 5 ай бұрын
I don‘t find that illogical at all.
@boristenkes
@boristenkes 5 ай бұрын
Perfect timing... I've had problem with this on project I'm currently working on for 2 days now and you just solved it. Big thanks!!!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Glad I could help!
@ahmedivy
@ahmedivy 5 ай бұрын
Same 😂
@malikau917
@malikau917 5 ай бұрын
ChatGPT it next time
@EdwardWongHauPepeluTivruskyIV.
@EdwardWongHauPepeluTivruskyIV. 5 ай бұрын
deadass 😂
@tanveermughal3935
@tanveermughal3935 5 ай бұрын
I used to do it with flex box but now i use grid where i need to have scrollbar. Rule of thumb is to give a fixed or 1fr width/height to row/column on which you want scroll. Add overlow-hidden on parent (container with grid class) and overflow-auto on scrollable container. Every container will take its own width and height.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Thanks for sharing!
@kruseverve
@kruseverve 5 ай бұрын
I just was dealing with this same issue! Btw that was a smooth af transition
@gautampatoliya6872
@gautampatoliya6872 4 ай бұрын
A big disagree button
@TheItamarp
@TheItamarp 5 ай бұрын
Its only frustrating and illogical if you don't bother understanding the rules. For the most part, unless you define otherwise, the way CSS works assumes that it can grow as much as it needs to in the vertical direction to contain the content. For overflow to have any effect, the element's height needs to be constrained to a size smaller than the content. So, unless you tell it something else (by setting a fixed height for example) flex-grow will, well *grow*...
@taragnor
@taragnor 16 сағат бұрын
Honestly a lot of the rules are annoying and non-sensical. Certain properties get ignored in certain contexts for no discernable reason. Programming languages are logical, with CSS it just feels like a bunch of bureaucratic red tape you have to follow.
@schatten105
@schatten105 4 ай бұрын
I See you talking about css but don't Show any css at all (yes i know what tailwind is, that's not the point)
@ZacharyPrice
@ZacharyPrice 4 ай бұрын
lol this isn’t frustrating at all… I’d recommend understanding why CSS works this way as opposed to putting your faith in TW.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
It is an opinion. I do understand how CSS works. Maybe Google my name along with CSS. That doesn't mean I can't be frustrated by it or wish something worked a differently. Read some other comments for my thoughts. And there's nothing wrong with tailwind. It's simply another tool. You will get further in life without being condescending though.
@ZacharyPrice
@ZacharyPrice 4 ай бұрын
@@DaveGrayTeachesCode I certainly didn’t mean to insinuate that you didn’t understand CSS, my comment was an alternative to others looking for advice that share the current school of thought which is that TW will solve everyone’s problem. IMHO TW doesn’t solve any other problem that simply understanding CSS would. I personally see zero advantages to TW outside of creating faster but it doesn’t help people understand what is happening. It also disastrously affects legibility in semantic markup. I would argue as much but I’m certainly not naive enough to think I know everything either. No condescending marks were made.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
@@ZacharyPrice gotcha. I took it directed at me. Sometimes I read too many KZbin comments in a day lol. There are nice ones but they can also bring you down. I agree that everyone should learn CSS first. Tailwind fold is a nice extension for hiding all of the classes. A couple of benefits in my opinion are a nicely defined class naming system that is easy to learn and tailwind only ships the code you are using. Lots of old bloated CSS files out there that haven't been cleaned. Thanks for your reply.
@pablogodoy6645
@pablogodoy6645 4 ай бұрын
The old and reliable controversy to make interactions, take mine! 😂. This kind of mindset it's not reconmended for an engineer. It's a dev's responsibility to know how to use their tools properly. Invent solutions, not problems.
@securefolder4548
@securefolder4548 4 ай бұрын
If you don't have the knowledge about how it works don't ruin it for others. There's no magical it's some basics css and flex stuff that you probably never learned 😂😂 lol
@frovuks8523
@frovuks8523 4 ай бұрын
It does not defy logic, you just don’t understand it. Read some css documentation and how does flex work and maybe then you’ll figure it out
@calebprenger3928
@calebprenger3928 4 ай бұрын
Here is tour mistake......you are using tailwind
@quinson93
@quinson93 5 ай бұрын
Weirdly enough, I was trying to figure this out just two days ago for a project. Looks like my agent has my back!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Glad it helped!
@SaintPepsiSanCoca
@SaintPepsiSanCoca 5 ай бұрын
Skill issue!! 😂
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Such a weak reply. You can say that about anyone who is learning anything. However, I'm showing how someone can be frustrated, what the solution is, and why it doesn't seem to make sense. Setting an explicit arbitrary height value that is overridden by flex-grow anyway seems illogical. It would be better if in this column context, flex-grow implicitly applied a height.
@정희-b3k
@정희-b3k 5 ай бұрын
Because page can theoretically grow in height infinitely, you must specify the height when you dealing with limited height with scrollbar.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
That's right. I was explaining why it is frustrating and feels illogical. It just seems illogical to need to provide an explicit height that will not be used when I have already implicitly applied height with flex grow. Confusing and frustrating for many. Of course some will disagree.
@detore
@detore 5 ай бұрын
Initially your height was set to auto. Then you set it to an explicit value. That's it. There's no reason to think flex-grow would influence the height property any more than influence the color property.
@detore
@detore 5 ай бұрын
The better question is, why does setting flex-grow take up any more room at all. What property is giving its parent all that extra height? I don't know tailwind so I can piece it together from your code
@DoUrden09
@DoUrden09 5 ай бұрын
⁠@@detoreit’s just CSS behind. There is no explicit height anywhere on the y axis. Flex-grow will take as much as possible with its content, which is shown here with no text vs a lot of it. It behave the same way as normal. There is no solution that can magically know what height the dev expect without specifying one. Whether it’s grid or flex or anything, to get the same result will require a height of some sort.
@detore
@detore 5 ай бұрын
@@DoUrden09 no, but I mean. When he hits flex grow with an empty text field, it still grows. So something in the parent hierarchy has to have something creating height outside of content related.
@travelan
@travelan 4 ай бұрын
This is 100% a Tailwind issue, not a CSS issue. Tons of ways to do this in CSS easy peasy.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
This is not a tailwind issue. I can show this same problem by applying CSS in the same order. In fact, that is what tailwind does. It just applies CSS based on predefined classes. So if I did not apply a height value first using standard CSS, I would have the same issue. I did this specifically in this order to show why CSS can be frustrating. I also show the solution which is simply to apply a height value whether you're using tailwind or CSS.
@zenatimohammedel-amine6646
@zenatimohammedel-amine6646 5 ай бұрын
Actually I find it more logical this way because if you give it a flexible height than it doesn't have a real height so there Is no way for the browser to know at which point an overflow will apply, with a fixed height it works totally fine
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I knew some would disagree. It is an opinion. That said, it feels illogical because the height responds as we want it to when we implicitly say we want a height with flex grow. It is strange to then have to explicitly set an arbitrary height value that we will not use.
@millos0116
@millos0116 3 ай бұрын
​@@DaveGrayTeachesCode So what is the point of your video if anyone has their own opinion?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 ай бұрын
@@millos0116 You can't deny everyone has their own opinion. I have two points in making this video - empathy for many who have asked me about this or similar situations with flexbox and I believe flexbox in a column context should implicitly apply the height value that it will override anyway.
@jsterling6376
@jsterling6376 5 ай бұрын
How does that defy logic? Overflow handles overflow.. can’t have overflow if you don’t have defined dimensions.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
It's an opinion and I knew some would disagree. That said, I show the order of events that makes it feel illogical and why it can be frustrating. I feel like we should not be required to apply an explicit arbitrary height value that will not be used when we are already implicitly saying we want a height with flex-grow in a column context. In the column context, it would be nice if flex-grow implicitly applied this meaningless height value.
@theodorenegusu418
@theodorenegusu418 4 ай бұрын
Bro you're saying. in a container were there is no limit. You told a div container to grow until something limits it. Then you add content to it and that content will never overflow because the parents and the grandparents don't have no height limits.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
No, I'm saying in a column context, flex-grow should imply the meaningless height value that it will override anyway. I can apply a height of 1px to solve the issue I show, and that value is meaningless.
@theophiled
@theophiled 4 ай бұрын
The mistake is to use tailwind for everything instead of learning css fundamentals
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
I agree that everyone should learn CSS first. No mistake here though. I show a problem AND the solution while showing empathy for many who have asked me about this. I also highlighted a part of CSS flex-grow that I disagree with. In a column context, I think flex-grow should imply the meaningless height value that it will override anyway.
@rankarat
@rankarat 5 ай бұрын
lol using tailwind and complains, stop using it, its bad for understanding CSS;
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I know both well. Not complaining. Empathizing. I show a common issue and how to solve it.
@mjdev-i1p
@mjdev-i1p 5 ай бұрын
thats because you use tailwind and not css .. clearlyna skill issue
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
You made more than one incorrect assumption in your statement. Tailwind simply applies CSS classes and has nothing to do with it OR with a skill level. In addition, I do understand the issue and apply a height value during the video. The point was to share why CSS can be frustrating. I knew some would disagree because it is an opinion. In my opinion, it feels illogical to require an explicit arbitrary height value that won't be used when I implicitly already applied a height with flex-grow. I wish flex-grow in a column context automatically applied this meaningless arbitrary height value.
@shaikhyamin3464
@shaikhyamin3464 4 ай бұрын
If css is frustrating then you are not getting how css works !!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
That's a hardline opinion. Learning things can be frustrating. I made this video with empathy for many who can feel the frustration. Nothing wrong with being frustrated from time to time or wishing something worked differently. And I do understand how CSS works. That said, for this specific example, I really believe flex-grow in a column context should imply the height value that it ends up overriding anyway.
@herzaislad
@herzaislad 5 ай бұрын
That's pretty basic. Auto means if content is less than the container height, scrollbar won't show, but if content is more than container, the scrollbar will show. You have to set the height or maxheight of the container in order to show the scrollbar and limit the content height.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I knew some would disagree. I know how it works and show you need to apply a height. However, it feels illogical to require explicitly applying an arbitrary height value I won't use after I have implicitly said I want a height with flex-grow. It would be nice if flex-grow in a column context applied this meaningless value automatically. Some will agree and some won't.
@henriqueomena7686
@henriqueomena7686 4 ай бұрын
Hey, from my point of view, this behavior makes sense because, by default, the height value is set to auto. So, it's normal for your ul to extend when you add more content. How will CSS know when you want a scroll to appear? The height, in this case, acts like a breakpoint for the scroll to know when it should appear.
@iznasen
@iznasen 5 ай бұрын
you are the weired part here. it needs a max-height
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
No, I'm just sharing an opinion, and showing one example of why CSS can be frustrating. As I show in the video, it is easily fixed by setting a height value.
@picklenickil
@picklenickil 5 ай бұрын
The way you wrote css ..was... God bless my soul, blasphemic in the first place
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Or you could say with empathy for those that have asked me questions like this lol.
@picklenickil
@picklenickil 4 ай бұрын
@@DaveGrayTeachesCode wasn't meant to upset you. That's how we talk in my community. Hyper criticism means 💕💕
@dustingunter9163
@dustingunter9163 5 ай бұрын
You mean you need to tell a block level element how tall it is so it knows when to start scrolling? weird
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I get the sarcasm, but I show the path that leads to the confusion and others say it helped. While I show adding a height fixes the problem, it does feel illogical to add an explicit arbitrary height value that won't be used. I think flex-grow in a column context should implicitly add this meaningless height value.
@dustingunter9163
@dustingunter9163 5 ай бұрын
@@DaveGrayTeachesCode You're good dude, turns out I was just hangry. I have an issue with the whole front end paradigm right now. Most of it is way more complicated than it has any right to be, theres a long list illogical things like this that can be avoided by simply NOT using these type of frameworks. Might just be me.
@MartinBarker
@MartinBarker 5 ай бұрын
My biggest pet peve with people's idea of CSS now is the amount of classes you have on the elements instead of just one class and it setup correctly in CSS, at that point your not actually coding CSS, therefore not learning it.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I do recommend learning CSS before using any class library like Tailwind.
@toggod3192
@toggod3192 5 ай бұрын
It makes sense, though the computer doesn't know you gotta tell it every little detail
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
It makes sense if you already know the rule. I show why some get frustrated with this. It seems illogical to require an explicit arbitrary height value that will not be used when you already implicitly state you want a height with flex-grow in a column context. It would be nice if, in the column context, flex-grow already applied this meaningless height value.
@jr_omw
@jr_omw 2 күн бұрын
flex grow + overflow auto I use it often and is literally the thing I found the weirdest about CSS, glad to have found this is not uncommon
@casperon7
@casperon7 2 күн бұрын
If you really understand css, you understand the logic
@zancrow_gaming
@zancrow_gaming 4 ай бұрын
It's really frustrating. Sometimes with no height, it works. Sometimes it doesn't Really annoying. I encountered this issue 2 days ago did it another way but I will try this, alot easier
@Dylan_thebrand_slayer_Mulveiny
@Dylan_thebrand_slayer_Mulveiny 4 ай бұрын
It's not a flaw of css. It's a lack of knowledge of how css works. If you can't solve problems like this, then you shouldn't be charging people money.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 4 ай бұрын
Lots of errors in your comment. First, I created this video with empathy for the people who have asked me about it. I show you need a height value, so yes I know the solution. However I understand why it is frustrating for others. That said, you also say I'm charging people for content. I have not even created one premium course yet although I plan to. And yet even by your standards I'm not disqualified to do so because I do show the solution to this problem. So yeah KZbin comments like this are ugh.
@troooooper100
@troooooper100 4 ай бұрын
it's illogical in the same way as having a door with no door handle, yes you can open it but it defies logical expectations. There should be a simple way for devs to define what the behavior should be... fill the parent, fit the content, be percentage of parent, be fixed amount... honestly it's very unreasonable.. if it was upto me i'd do this %|min|max of eleID|parent|children|sibling height: min(children, 300px, 50%), max(#id.position.x), grow;
@Dylan_thebrand_slayer_Mulveiny
@Dylan_thebrand_slayer_Mulveiny 4 ай бұрын
@@troooooper100 it boils down to the fact that css is driven by math. If you want 50% of something, you need to know what something is. If something doesn't have an explicit value, then you're essentially calculating 50% of nothing.
@troooooper100
@troooooper100 4 ай бұрын
@@Dylan_thebrand_slayer_Mulveiny everything has computed value
@simionvlad9510
@simionvlad9510 Күн бұрын
So true, 90/100 of devs have no basics. They start already with frameworks but they have no idea what really happens.
@GenericInternetter
@GenericInternetter 5 ай бұрын
if height __then ____auto-adjust to height __else ____fk the dev
@zgmg9263
@zgmg9263 4 ай бұрын
CSS is hard yes but you don't have a height on the container
@snivels
@snivels 2 ай бұрын
I think you can accomplish the same with 'basis-full' and 'shrink-0' and 'grow-0' no?
@fahimcasual
@fahimcasual 5 ай бұрын
"It defies logic" and that is exactly why AI won't replace coders
@daniellittlewood8471
@daniellittlewood8471 4 ай бұрын
"I should have scrollbars with all of this content, right?" No! What you want is actually not meaningful. You indicate that *if* the content is too big, *then* there should be scrollbars. But you never said what "too big" means! Without an explicit height, css would have to reach into your mind to know you "really wanted" the box to fill the viewport. That is not (and should not be) the default.
@troooooper100
@troooooper100 4 ай бұрын
there is also fit-content and etc but not not supported enough yet but holy it's all so annoying... i had an issue with position sticky... guess what certain properties like transform F@@ks it up because it creates a new layer which changes the view port. scrolling caused it to scroll with everything because new layer was part of that, it became sticky to that new layer ... honestly wtf.
@jeremyrichardgithuba5257
@jeremyrichardgithuba5257 2 ай бұрын
Your voice sounds like the ai generated captions, I thought I was tripping
@abbassiziad1379
@abbassiziad1379 5 ай бұрын
Css is an old school solution. Modern dev needs something else. Maybe something like flutter.
@factzfactory4956
@factzfactory4956 5 ай бұрын
What if we use overflow-y-scroll ? I guess we dont have to define height
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I'd rather not show the scrollbars until necessary. Really the only difference between auto or not.
@falcodxb
@falcodxb 4 ай бұрын
Saul Goodman escapes prison, grows his hair out, and lives the rest of his life out as a web developer.
@WWASHD
@WWASHD 5 ай бұрын
Im not an expert cuz it kinda makes sense, your machine doesnt know resolution, so he just prints
@sengchhunchhum2532
@sengchhunchhum2532 5 ай бұрын
Or you can just add basis-0 the element you want to be scrollable.
Roasting Your Dev Portfolio Sites | Livestream highlight
19:24
Anthony Sistilli
Рет қаралды 81 М.
Use these instead of vh
6:06
Kevin Powell
Рет қаралды 510 М.
Amazing Parenting Hacks! 👶✨ #ParentingTips #LifeHacks
00:18
Snack Chat
Рет қаралды 22 МЛН
规则,在门里生存,出来~死亡
00:33
落魄的王子
Рет қаралды 16 МЛН
The day of the sea 😂 #shorts by Leisi Crazy
00:22
Leisi Crazy
Рет қаралды 1,8 МЛН
The Most Legendary Programmers Of All Time
11:49
Aaron Jack
Рет қаралды 566 М.
The Simplest Tech Stack
9:38
Awesome
Рет қаралды 118 М.
The Home Server I've Been Wanting
18:14
Hardware Haven
Рет қаралды 147 М.
This is Why Programming Is Hard For you
10:48
The Coding Sloth
Рет қаралды 884 М.
No Code App Development is a Trap
9:31
Coding with Dee
Рет қаралды 256 М.
CSS Tips And Tricks I Wish I Knew Before
12:12
Lama Dev
Рет қаралды 480 М.
These CSS PRO Tips & Tricks Will Blow Your Mind!
8:48
Coding2GO
Рет қаралды 342 М.
Full Stack Developers will take over. This is why.
11:26
Ed Andersen
Рет қаралды 48 М.
Add a Honeypot to Your Forms 🐝
0:45
Dave Gray
Рет қаралды 722 М.
5 Signs of an Inexperienced Self-Taught Developer (and how to fix)
8:40
Amazing Parenting Hacks! 👶✨ #ParentingTips #LifeHacks
00:18
Snack Chat
Рет қаралды 22 МЛН