How to take control of Flexbox
118,375
Published 2024-03-26
π Links
β The original design on Dribbble: dribbble.com/shots/23583273-Hotel-Card-Components
β My code from this video: codepen.io/kevinpowell/pen/yLrgydQ
β Flexbox Simplified: flexboxsimplified.com/?utm_campaign=general&utm_source=youtube&utm_medium=howtotakecontrol
β Timestamps
00:00 - Introduction
00:25 - What we are starting with
01:18 - Understanding what happens when we use display flex
05:00 - What flex-shrink does
07:40 - Adding in flex-grow
10:19 - Making things more consistent by defining the size
#css
--
Come hang out with other dev's in my Discord Community
π¬ discord.gg/nTYCvrK
Keep up to date with everything I'm up to
β www.kevinpowell.co/newsletter
Come hang out with me live every Monday on Twitch!
πΊ www.twitch.tv/kevinpowellcss
---
Help support my channel
π¨βπ Get a course: www.kevinpowell.co/courses
π Buy a shirt: teespring.com/stores/making-t...
π Support me on Patreon: www.patreon.com/kevinpowell
---
My editor: VS Code - code.visualstudio.com/
---
I'm on some other places on the internet too!
If you'd like a behind the scenes and previews of what's coming up on my YouTube channel, make sure to follow me on Instagram and Twitter.
Twitter: twitter.com/KevinJPowell
Codepen: codepen.io/kevinpowell/
Github: github.com/kevin-powell
---
And whatever you do, don't forget to keep on making your corner of the internet just a little bit more
All Comments (21)
-
One thing you said here I had never thought about was the fact that flexbox is controlled inside-->out, but grid is controlled outside-->in. That makes a lot of sense and actually clarifies a lot more of this. Thanks for all of the amazing videos!
-
Excellent explanation! Flexbox is inside -> out, grid is outside -> in!
-
So much pain healed thanks to this guy
-
I think the issue with people understanding flexbox is due to them not working with HTML tables, because, if they had, theyβd see how both use a similar β if not the same β resizing behavior. Every time I use flexbox, I think of them as defaulting to being like a table row β where it can only have one row β and, just like tables, you have to define the behavior you want. This proves that the algorithm for tables were a good solution for layout, but breaking it up into two layout properties (flexbox and grid) gave us much more control over that algorithm. This is what CSS is about, I think all the interactive parts of CSS could be turned into a new language and that might make that simpler. Itβs as though things like animations, transitions, and transforms are all complex due to having to fit into the CSS design specifications. I understand these very well, but find the syntax is the most complex part of it, since CSS was designed for layout and styling.
-
Thank you Kevin! βContent is king in flexboxβ is going to stick with me. This video really helped me get a much better understanding of flex shrink and grow and how they can be used in many layouts. Thank you for developing and sharing such useful content!
-
Before this video i was controlled by flexbox. Now I'm controlling flex box:face-blue-smiling:
-
Great overview. Thanks, Kevin.
-
Excellent!! I've been avoiding flexbox for so long, this helps a ton
-
thanks! you're always helping demystify tricky behavior!
-
Every time I have an issue to solve, you upload a video related! its so great! thanks for such amazing content always!
-
That's why i prefer to use grid instead of flex. Thanks for useful content as usually
-
Feel like finally getting to Flexbox. Thank you!
-
amazing stuff! this will help my projects a lot!
-
love it! π
-
Sir, i would like to confess that you are simply the best.
-
Excellent explanation. Thanks!
-
taking advantage of flex grow and shrink really made my layots mch better
-
felt like reading css manual while watching the video thanking you sir!ππ
-
Really saved my time dude, thanks!
-
i wouldn't bother guessing or forcing the size of the middle part you should align images to avoid inconsistencies (which in my opinion is the best place to set flex-shrink to 0) and send metaboxes to the right-hand side (either with automargin or with flex-grow in the middle). then you can let the latter two play or fix the size of the metabox if your design is grid based