A new approach to container and wrapper classes

  Переглядів 237,626

Kevin Powell

Kevin Powell

День тому

The wrapper or container is probably the most common design pattern around, but after coming across an article by Stephanie Eckles looking at how we can use a grid to emulate a container, and have simple breakouts - smolcss.dev/#smol-breakout-grid - I had an idea of how we could do this to completely drop the idea of containers, and then had my idea validated when I found an article by Ryan Mulligan - ryanmulligan.dev/blog/layout-... - exploring that same idea!
So in this video, I take a look at how we can set it all up. I won’t lie, it’s a little complex, but I think the payoff is worth it, and I’d also love to know what you think!
🔗 Links
✅ Finished code: codepen.io/kevinpowell/pen/Ex...
✅ Steph’s SmolCSS Breakout: smolcss.dev/#smol-breakout-grid
✅ Ryan’s Layout Breakouts with CSS Grid: ryanmulligan.dev/blog/layout-...
✅ Steph’s newsletter: thinkdobecreate.com/newsletter/
✅ Getting started with CSS grid: • Learn CSS Grid the eas...
⌚ Timestamps
00:00 - Introduction
01:07 - What we could have instead
02:35 - Inspiration for this idea
03:45 - Setting up the grid with named lines
06:30 - Adding a breakout to the grid
08:45 - Adding a full-width to the grid
14:42 - Improving the column sizes
#css
--
Come hang out with other dev's in my Discord Community
💬 / discord
Keep up to date with everything I'm up to
✉ www.kevinpowell.co/newsletter
Come hang out with me live every Monday on Twitch!
📺 / kevinpowellcss
---
Help support my channel
👨‍🎓 Get a course: www.kevinpowell.co/courses
👕 Buy a shirt: teespring.com/stores/making-t...
💖 Support me on Patreon: / 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 UKposts channel, make sure to follow me on Instagram and Twitter.
Twitter: / 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 awesome!

КОМЕНТАРІ: 591
@42pe
@42pe 3 місяці тому
I’ve been working in web dev for 20+ years, and this is one of the few times I’ve seen someone come up with an alternative to such a huge industry standard and actually offer a simpler, viable one. Kudos to you!
@BlackistedGod
@BlackistedGod 6 місяців тому
damn, I have been working with HTML/CSS for more than a decade and been looking for a solution like this. I'm the type of guy who wants to keep HTML structure as simple and short as possible.
@FreeScience
@FreeScience 3 місяці тому
To be fair we haven't had grid (or flex-box) for that long :)
@bryandenijs7661
@bryandenijs7661 6 місяців тому
A while ago I had exactly this requirement to solve. Ended up with a lot of container elements and I hated it, but didn't know a better solution. This would have really helped me. I really like it and I don't think it is over-engineered at all. I think it's a very clean way without al those wrapper/container elements. Thanks for the inspiration!
@ZimmervisionCZ
@ZimmervisionCZ 6 місяців тому
Yeah I definitely prefer this over wrappers or containers, especially because I'm a bit opinionated that markup should be content. In my opinion, a wrapper div is a form of coupling between markup and style that is best avoided.
@MayhemPhone
@MayhemPhone 6 місяців тому
Agreed. The hours, and hours of refactoring I’ve had to do when suddenly a designer adds a breakout element… my god. I would need to use this for a full project, and see how it holds up… but my gut says this is a really elegant solution to an often messy problem.
@jcsilverx
@jcsilverx 6 місяців тому
x2. It was already somewhat tedious, but this... solves the problem. =')
@t3hpwninat0r
@t3hpwninat0r 5 місяців тому
print designers do this stuff all the time. so annoying for us web developers to code, but not any more!
@simonced
@simonced 6 місяців тому
It is a complex solution, but it's the kind of solution you do once, then you can forget about it. That outweighs the complexity, and will improve clarity in the HTML, which is usually where it can get really messy. What a great solution, I'll try something like that in my next project, thanks for the idea!
@Dead_Goat
@Dead_Goat 3 місяці тому
containers are for more clear than this...
@dom8429
@dom8429 6 місяців тому
html structure should be as simple as possible (because it's what get's updated most). if that means we move the complexity into a long line of css that's an excellent trade-off! you always have complexity, the question is just *where* you put it. of course in some cases it makes more sense to have a quick max-width container instead of a robust and flexible solution like this. but it's really good to know this and be able to choose. thanks so much
@Novacification
@Novacification 3 місяці тому
This is one of the things that easily gets difficult with something like react. Component structure, especially when using component libraries, often adds a lot of DIVs to the DOM structure. You can avoid it nowadays but many developers who "grew up" with react don't give it much thought and add DIVs instead of fragments etc. It's also frustratingly common for people to leave DIVs around with conditional renders because they only wrap the DIV content in the condition, not the containing DIV itself.
@bumbleguppy
@bumbleguppy 6 місяців тому
I started out in the XHTML era and the disciplined notion of a hard separation of the semantic html and style makes this nostalgically appealing. I can't see how this wouldn't be better for accessibility.
@forbiddenera
@forbiddenera 5 місяців тому
xHTML is alive and well and thus makes me cringe to see single quoted attributes. Also, container/wrapper divs aren't helpful for accessibility per se but you can make them ignored.
@isaacpriestley
@isaacpriestley 2 місяці тому
I thought XHTML was gonna be the coolest thing in 2005. I loved the idea of really pure HTML.
@VilleTakanen
@VilleTakanen 6 місяців тому
As a person who also occasionally does paper layouts - I love this. It's a very analog approach to page grid ❤
@omgnowairly
@omgnowairly 6 місяців тому
This is pure gold. For markdown formatting or user submitted content, this allows a new level of presentation.
@VeitLehmann
@VeitLehmann 6 місяців тому
This is really neat! Until now, I only used named grid areas or no names at all. I didn't know that you could create nested named grid areas via named start/end grid lines. Thanks for the great demo, I love it! Easy to understand CSS, really easy to apply and work with in HTML, and every removed wrapper div is a good thing!
@cubbucca
@cubbucca 5 місяців тому
love how this covers every screen size without the need for @media
@RuneScapeZammy
@RuneScapeZammy 6 місяців тому
This fits exactly the kind of "exception" to over-engineering you defined in your talk at CSS Cafe, which I very much agree to. I can imagine this to be made even easier and more versatile with a postcss function or SASS mixin/function. The biggest benefit, besides wrapping, that I see, is to make it even easier to work with CMS content. You will just be able to use a class or even just define grid areas for certain content types and elements.
@leobetosouza
@leobetosouza 19 днів тому
Thank you for it. I've hated containers and wrappers for 15 years.
@kobi-kobsen
@kobi-kobsen 5 місяців тому
There is really nothing wrong with containers, but this is just so much nicer. I still did not use grid, but as I watch your video I start changing my own little framework now. Thank you!
@zeddash
@zeddash 6 місяців тому
What I love about web development is that there's always something to learn and each challenge is a puzzle. Never thought to use grid for this but as soon as you showed you were using grid I knew where this was going. This is a far better solution than using wrappers.
@alirahmani5601
@alirahmani5601 6 місяців тому
I'm definitely gonna explore this. I'm a big fan of CSS over HTML, so I'm willing to write more CSS to avoid repeating myself in HTML by cluttering my markup with many classes!
@tonyr.6637
@tonyr.6637 6 місяців тому
CSS was invented to avoid *exactly* this kind of HTML clutter. You are helping it fulfill its destiny! 🔮
@doug7897
@doug7897 6 місяців тому
Main thing I like about this over auto-margins is you can use justify-items to keep inline-block/fixed-width items aligned to the left/right of the content bounds, rather than stuck centered without a dummy wrapper.
@AmyDePalma
@AmyDePalma 5 місяців тому
Really love this idea. So simple yet flexible. I'm working on a super-lightweight, non-framework-based set up for my company's sites and am super excited to play around with this! Thanks for taking your time.
@JoseMVelazquez
@JoseMVelazquez 6 місяців тому
Anything that reduces the excesive use of container divs we see these days is a welcome change for me.
@adammarostica3016
@adammarostica3016 6 місяців тому
I absolutely love this! Set it up once and then you’re set. This is brilliant. Thanks, Kevin!
@aje9633
@aje9633 6 місяців тому
this one is a lifesaver.!!! Literally, it got my mind blown that this could be possible.
@MayhemPhone
@MayhemPhone 6 місяців тому
Imo, it moves all the complicated bits into one spot, and massively simplifies everything else that is implemented. if I joined a project where all I had to do was add a breakout class on something, I’d sob with joy. Bravo.
@PicSta
@PicSta 6 місяців тому
Never thought anything like this is possible. Very good approach and I don't see any issue using two classes for the same. Excellent tutorial, Kevin, keep up this good work. 😄
@Akshatgiri
@Akshatgiri 5 місяців тому
Love it. This finally allows us to keep our html only to the markup that actually contains the content instead of having to create unnecessary boxes just for a simple layout.
@joshreynolds4164
@joshreynolds4164 6 місяців тому
Love it, I found Ryan's version of this a few months back and it's been so useful. As you say, can kind of just drop into projects and update the variables as needed
@pythagoran
@pythagoran 6 місяців тому
man, several of your recent videos made me stop and have to update my existing projects because the advice and benefits are so extraordinary! i no longer need to keep up to date with recent front end developments when i can just watch this guru right here :)
@janemig
@janemig 6 місяців тому
Being someone who is comfortable using containers/wrappers where needed, this seems like a cool new way to center your main content. I'll try it out and circle back! Thank you as always!
@anthonybradshaw5155
@anthonybradshaw5155 6 місяців тому
Just did this on a blog I recently built and it's made development so much more hassle-free. The blog uses a CMS with pre-defined, custom-built components, and instead of adding wrappers to every 'text block' component, we just have one div that wraps the whole article - each text block simply pumps out HTML directly from the text editor. At the same time, we can create fancy new full-width components & mini-apps and drop them in middle of an article. It works great.
@thomasw.enderle6565
@thomasw.enderle6565 6 місяців тому
Love this. No need to play around with negative margins and stuff to breakout of a container. I think this makes so much sense!
@MichaEl-rh1kv
@MichaEl-rh1kv 6 місяців тому
Perfect. Far more clean than those wrapper divs, and also perfect versatility, easy responsiveness, one-place-does-it-all for multiple projects,... Thank you!
@jhasani79
@jhasani79 6 місяців тому
This actually solved a problem I was working on. Thank you so much for this! And yes, it is a bit of a setup, but I think in the long-run it saves so much time and effort.
@marymaundu1702
@marymaundu1702 6 місяців тому
Hey Kevin. Just want to say thank you so much because I have finally conquered responsive layouts and I'm super proud of myself but also so grateful for your course and guidance. I have finished the final challenge of conquering responsive layouts and I can now confidently create responsive sites. No longer dreading CSS but actually love it now.😅😊
@ed1nh0
@ed1nh0 6 місяців тому
Sometimes I feel like CSS is diging a deep dark rabit hole, where only wizards can walk through it. Great content btw, as always!
@tonyr.6637
@tonyr.6637 6 місяців тому
I think you are confusing *Alice In Wonderland* with *The Lord of the Rings* . ;-)
@ed1nh0
@ed1nh0 6 місяців тому
@@tonyr.6637 hahahahaha you're right! But you got the point! 🤣
@JasonDuerrPDX
@JasonDuerrPDX 6 місяців тому
Elegant *and* flexible. I'll be swiping a handful of things from this one. Thanks Kevin! Great work as always.
@DominicRossYD33
@DominicRossYD33 6 місяців тому
Mind. Blowm 🤯 I love this idea. I hate the way a lot of modern websites are just div soup. You're inside a dozen div's before you even get to the content, it's nuts!
@tictac1020
@tictac1020 4 місяці тому
Excellent stuff, Kevin. Have taken a break from front of the front end stuff for a bit and am jumping back in and seeing what I've missed. Glad to see you are still bringing the light of CSS to the masses.
@lukedorny
@lukedorny 6 місяців тому
Love the ability to have an article tag span across several “sections” without having to close them. Also improves our ability to keep the markup semantic.
@lukedorny
@lukedorny 3 місяці тому
Now show us the subgrid version?
@joaquingarcia7075
@joaquingarcia7075 5 місяців тому
Awesome, love it! The full width and the breakout are so needed in projects, and this is a clever way to get through them and not have to make a lot of CSS to get to the same result with a conventional container.
@abramthau558
@abramthau558 5 місяців тому
Kevin, I've watched a lot of your videos, and this is the first time I've felt compelled to comment because this is FREAKING. AWESOME. I will definitely be using this technique, plus I love the whole named lines to make implicit grid areas!
@matthiasploetz998
@matthiasploetz998 6 місяців тому
This is a lovely idea. I agree with a comment below "unless a container/wrapper makes sense semantically ...". Always start with good HTML. What I really like about it is having only one major grid to put your UI elements into. You can create an overall consistent spacing strategy throughout your page. I wonder though if most of the time it only ends up being a starting point and you end changing the grid multiple times before you are done. I guess it saves designers jobs if the web developer community all use the same one-column layout with 60 to 90ch max-width content. It should make more interesting grid layouts stand out even more.
@theomegamale5335
@theomegamale5335 6 місяців тому
This is going to make my life really easy with a platform i am developing right now. Im someone who hates extra html, so this succinct kind of approach is phenomenal. Great video !
@visuellegedanken
@visuellegedanken 5 місяців тому
I just love how happy this solution is making you. I'm very intrigued because I definitely feel the .wrapper pain. I'll give it a test run as soon as I start a new project.
@codcut
@codcut 6 місяців тому
I was just doing some crazy stuff just to be able to breakout some parts of the content. Now I'm redoing everything because of you!
@dqampire
@dqampire 6 місяців тому
I was already using your grid in "how to escape from containers" video. This one is adds even more flexibility, love it!
@jpmorse1982
@jpmorse1982 6 місяців тому
I am a newbie to frontend design and these videos are a massive help thank you. I am currently building a help webpage for work and spent hours aligning sections where I wanted but using this idea to simply name a section and it positions and look how I wanted. I recreated my webpage with this idea and it took just minutes to do. Granted most of that time was setting this up but overall much quicker.
@wecm8991
@wecm8991 5 місяців тому
I always thought that it won't hurt to use wrappers or containers if they make my life easier. But this solution is just awesome! Thanks for sharing!
@NickHempsey
@NickHempsey 6 місяців тому
I love this approach, we used something similar on a project when grid was just coming out, but it wasn't this clean. I'm looking forward to playing around with this further!
@sofocused7767
@sofocused7767 6 місяців тому
Excellent solution. Everytime I watch I go and rewrite my css. This is just golden! Super simple to copy and paste to other projects as well.
@ofcljaved
@ofcljaved 6 місяців тому
I absolute love it, It's a masterclass and it will take 2-3 rewatch to understand it but it'll help in long run
@maxfri6680
@maxfri6680 6 місяців тому
This is such a clean solution. 😱 Also because grids are perfect tools for animations with fr units and using this layout will open up a lot of possibilities. Thank you for sharing!
@artboeckchen1247
@artboeckchen1247 6 місяців тому
I really like this approach. It's much tidier and logical for me. It preserves the semantics of HTML much better.
@Maeckboom
@Maeckboom 6 місяців тому
You effectively created a subgrid-like effect without relying on the CSS 'subgrid' property, well done! This could have saved me a lot of time in the past styling CMS content.
@boby4751
@boby4751 4 місяці тому
I agree that is looks like a mess and complicated, but, I understand how versatile the code is, like you said, you change a few things and it just works without having to code multiple lines for every change that is being made. I love your videos, they are simple to understand and to the point.
@jshstuff
@jshstuff 6 місяців тому
I also came up with this same strategy on my own and have been applying it to redesigns of some major sites because I love it so much. A few weeks ago I pasted my version under your video about escaping a container on only one side - when you made the teaser community post I actually thought you got the idea from me since I'd never seen anyone do this kind page layout and I'd just shared my code like 2 days earlier, but I guess it's humbling to hear that people discovered the same thing over a year ago :)
@deathscry1
@deathscry1 6 місяців тому
Kevin I think I'll say what most of us think.. It's great and we love ❤ it! I think I'll take some time and see how would it look when implemented on my website and then get back to everyone. That might be the best way to verify the idea. I also use the same (way simpler) technique already with grid for padding and main content so it should be fairly "easy" to replace. Also thank you for the tip about named lines didn't know that was a thing.
@MultiWar22
@MultiWar22 6 місяців тому
I love this. I actually need this for a current project, and I was procrastinating doing that because I was thinking that there has to be a better way than just wrapping things. So thanks! I'll put it to use tomorrow
@mvonballmo
@mvonballmo 6 місяців тому
This was fantastic. Thank you very much. Really a tight tutorial, with just enough "mistakes" to show how you built it up. Not over-engineered at all. It's just as complex as needed, and no more. Responsive without media queries. Complexity hidden in the CSS. Even the CSS is reasonably legible. You could maybe use an extra variable to clean it up, but otherwise, great.
@melissafrasik9272
@melissafrasik9272 5 місяців тому
I am absolutely FLOORED by this method! I've been working through a project that implemented the full color background sections, much like your above example, but the number of wrapper divs required have been frustrating me endlessly. Although I've been using grid for years, I never realized you could name lines like this! This is such a beautiful, clean implementation! I also have a horrible habit of forgetting padding on the X axis until the very end, and this even fixes that! I would happily take a chunky grid boi over extra divs any day! Thanks for this video!
@ssygon2
@ssygon2 6 місяців тому
What a great solution! Beats trying to break out of the container using other ways which still 'not quite spans full width', all the way to the right side scroller: .full-width { width: 100vw; position: relative; left: 50%; right: 50%; margin-left: -50vw; margin-right: -50vw; } Your solution is way better than the above code! Even the following still feels hacky, and has some limitations: .full-bleed { box-shadow: 0 0 0 100vmax blue; clip-path: inset(0 -100vmax); }
@OrryVerpoort
@OrryVerpoort 6 місяців тому
I love this solution for symmetrical layouts. You could even do a compact column that goes smaller. I'm going to play with this concept and try to add asymmetrical breakouts.
@OscarObians
@OscarObians 6 місяців тому
This!
@MultiWar22
@MultiWar22 6 місяців тому
Seems like it should be pretty easy to add asymmetrical breakouts, right? Looks like a 1 line change to me, at first glance, but I haven't tried it yet
@iskimo01
@iskimo01 5 місяців тому
You just made me rethink the whole concept of grids!
@simondann7371
@simondann7371 3 місяці тому
I have serendipitously stumbled upon your video at the very time I needed it; thank you!
@error-bl4dm
@error-bl4dm 5 місяців тому
been looking for this solution a long time, I have this bad habit of putting everything into divs and just throw a grid and do specific styles or what. Damn helpful for doing content managements for front end developments kudos to you my guy
@mintcar
@mintcar 6 місяців тому
This is the most useful CSS trick I've found in years
@WBraxx
@WBraxx 2 місяці тому
My brain is on fire right now... I just learned a new way of setting up the initial template for my project. 🤯 Thank you! Teach me more!
@Bodom1978
@Bodom1978 6 місяців тому
Was going to dismiss this video but glad I watched it. Had not idea that I could do that with the grid section names. Very useful feature. Thanks for sharing 😊
@senorverano
@senorverano 6 місяців тому
Ok, I think this is indeed awesome. Especially since the flow of the document doesn't get interrupted as much as it does with the container/wrapper way of doing it!
@marcofante
@marcofante 6 місяців тому
This is a GREAT way to handle dynamic components retrieved let's say from a CMS, leaving the editor full choice over the design, while keeping a smaller markup footprint, I like it!
@krisztinavajdarygard6725
@krisztinavajdarygard6725 2 місяці тому
I absolutely love this. I work on large e-commerce solutions, where especially on CMS pages it's be hard to control the number of DOM elements created due to wrapper divs all over the place. This approach will save so many now superfluous DOM elements 🙌🙌
@thegeneralyst
@thegeneralyst 6 місяців тому
I think this is the next step to containers, while it does take a lot to setup it allows for complete control over how you want the containers to work and will save you a lot of time in the long run. I am definitely using this.
@JohnDoe-jc4xp
@JohnDoe-jc4xp 6 місяців тому
❤ this solution, I want to go back to my old projects in retrofit this into them. 😮
@HeyDanThomas
@HeyDanThomas 6 місяців тому
Love this! I've thought for years there should be a less divitis way to achieve these things. Thanks for sharing.
@Adlore
@Adlore 6 місяців тому
I love this solution. I've never used much of grid, but the abiliy to remove a bunch of wrapper divs seems great, and it solves a pet peeves of mine. The cleanliness of the html is a nice result
@BMikel
@BMikel 5 місяців тому
You could even not know frameworks like React or Vue, but still create amazing things just with Vanilla JS. Having a good command of CSS, HTML, JS makes you a wizard.
@vitaliilabunets6193
@vitaliilabunets6193 6 місяців тому
Awesome! Thnx for step by step exploration. Definitely useful staff
@SebastianZartner
@SebastianZartner 6 місяців тому
Great to see you finally talking about named grid lines (as I suggested that topic earlier). I believe they have great potential, though are very underused, at the same time, because they are a little hard to understand, at first. I really like your idea of defining breakouts with them! Having said that, it would have been great to compare it with the subgrid solution.
@NicholasZein
@NicholasZein 5 місяців тому
I love the versatility of this
@MattPriour
@MattPriour 6 місяців тому
Really love this approach! Thanks for showing it.
@BrandonLaDuke
@BrandonLaDuke 6 місяців тому
That's a great idea. I was actually trying to come up with something similar to that on a current project. But couldn't figure out an easy way to make it responsive. I never knew about the named start/end of grid areas. That's going to be very helpful!
@sevenstart7033
@sevenstart7033 6 місяців тому
That's a brilliant idea! I've often encountered difficulties maintaining the simplicity of my projects, especially with containers and the multiple levels of structures for grids and flows. This approach greatly simplifies achieving the desired widths without having to close and reintegrate the div tag elsewhere. During refactoring, I frequently found myself in a mess of elements that disrupted the design and forced me to reimplement the same style. I'm looking forward to trying this out in my current project. Thanks for the informative video and tips. I've subscribed and left a thumbs up 😄
@gerrcassytb
@gerrcassytb 6 місяців тому
love the idea. It seems like that kind of things you only need to get used to. Less wrappers also sounds like a good idea. Thank you.
@AgentProvocateur42
@AgentProvocateur42 6 місяців тому
This approach keeps your HTML clean and tight - really nice for accessability.
@zizak143
@zizak143 3 місяці тому
I love it, especially when editing legacy content on larger repository, this way I can go in with css and no need to touch the html and change the whole layout. Very interesting idea
@dasten123
@dasten123 6 місяців тому
I didn't know you could define grid areas like that, that is a super neat trick!
@nomadshiba
@nomadshiba 6 місяців тому
i think this is great the naming the columns part is whats new to me makes me wanna play around with it
@adnctz
@adnctz 6 місяців тому
Thanks for this, I'm planning to reduce the number of dom elements on our project
@jcsilverx
@jcsilverx 6 місяців тому
This is exactly what I was looking for! Thank you so much!
@crowebro9581
@crowebro9581 10 днів тому
I love this. I can see myself using this method quite a bit.
@YTEEsenior
@YTEEsenior 6 місяців тому
Good bye div wrappers! Thank you for showing us the modern way. Will never go back. Awesome work.
@abomayeeniatorudabo8203
@abomayeeniatorudabo8203 6 місяців тому
I'm always interested in the ideas you always introduce to us.
@CanRau
@CanRau 6 місяців тому
Used this couple of years ago on my personal blog. And right now re-evaluating for current project 🤓
@xbsidesx
@xbsidesx 6 місяців тому
I tried to do this kind of thing so many times. This is very elegant and readable (even being a line long). Thank you for this. Oh and I don’t know which solution I prefer but I think I’d end up with the 2nd (Redeclare) because it makes more sense to me.
@MrJettann
@MrJettann 6 місяців тому
Currently I'm working on a react project and I had to use a lot different wrappers, containers etc, and it pain in a butt. This can solve all these problems easy and 1 nice thing about this approach, that you can use only one main wrappers, probably main tag itself and use all needed classes to implement full width or wrapper like behavior in seconds, when I'm react components you should be really carefull to not break everything, thank you Kevin, will definitely use it!
@catalinim4227
@catalinim4227 6 місяців тому
I've never liked containers and wrappers, so I'm going to use this from now on.
@versionoriginal
@versionoriginal 6 місяців тому
Brilliant! Easy and very useful! Thank you! 😃
@EvanEdwards
@EvanEdwards 6 місяців тому
Dangit, after many years of my textflow content being flexbox in an article, I think I am going to switch to grid because of you, you grid-fanboy, you! ;D This is a fantastic presentation of good ideas for a very fundamental use case. It is advanced in conceptual model, not technical fancy features, and that makes it incredibly useful as a foundation to add those fancy features (subgrid and container queries really make this super powerful). It reminds me of the old 12 column layouts prior to flex and grid.
@fathercashew
@fathercashew 6 місяців тому
Wild to see something I've been re-engineering for years crystallized here in such an elegant way. This is the missing link to what I've been working towards - my solution involved a lot of CSS properties and calcs, but this is much more seamless and is still very robust. This kind of solution is far superior to wrappers, in my opinion. Yeah, it's a lot of set up at first, but then you can use in a utilitarian way and then just tweak the global values from project to project. Not to mention we get to kill one more layer of styling-only divs. 🎉 Also, huge thank you for cluing me into the fact that you can use simple line naming to define grid areas. I will be using that immediately. Thank you!
@blocSonic
@blocSonic 5 місяців тому
This is great! I really haven't used grids much yet and this makes a great case for doing so!
@JeremyChone
@JeremyChone 5 місяців тому
This technique is so cool. (Also, the quality and flow of the video are really good.)
@nickbrown6754
@nickbrown6754 6 місяців тому
I love this approach. I recently worked on a project where the designer had numerous column width / container sizes. This would have worked so well as I would have been able to set all container sizes to one grid layout instead of numerous container classes.
@UandUs-RicLeP
@UandUs-RicLeP 3 місяці тому
I’ve been using something very similar to this in a few projects for a while now and it’s great. Once you’ve set it up it’s a game changer. Couple of additions with the named tracks: You can span from one name to another, i.e. you could go from breakout-start to full-width-end - really handy for off-centre content, particularly if you add more tracks or have one for the very centre of the screen - you can then span from the edge to the middle. Works beautifully with sub-grid. You can add multiple names to a grid like [content-start break-outstart]. Why would you want to do this? When you want more control with breakpoints and scaling. On mobile you might have two tracks share the same size but on desktop you then create two different tracks like in the video. That might seem pointless as it’s responsive already, but if you want fine grain control, such as not liking when the breakout is only 20 pixels wider than the content, and want it to only break out when it’s 100 pixels wider for instance you can. There is so much scope with this technique, and using subgrid, or inheriting lets you simply align elements in different containers.
Avoid These 5 Awful CSS Mistakes
20:42
Kevin Powell
Переглядів 186 тис.
Container Queries are going to change how we make layouts
24:24
Kevin Powell
Переглядів 167 тис.
Vasiliy Lomachenko vs George Kambosos | INTERNATIONAL LIVE STREAM
3:10:05
Top Rank Boxing
Переглядів 1,1 млн
Эта Мама Испортила Гендер-Пати 😂
00:40
Глеб Рандалайнен
Переглядів 9 млн
CSS Only Scroll Animations Are AMAZING!
8:40
CSS {de}Coder
Переглядів 4,9 тис.
How to take control of Flexbox
16:01
Kevin Powell
Переглядів 77 тис.
23 CSS features you should know (and be using) by now
31:31
Kevin Powell
Переглядів 48 тис.
A better image reset for your CSS
11:16
Kevin Powell
Переглядів 104 тис.
Use these instead of vh
6:06
Kevin Powell
Переглядів 435 тис.
You might not need useEffect() ...
21:45
Academind
Переглядів 132 тис.
Are you using the right CSS units?
6:30
Kevin Powell
Переглядів 437 тис.
I never thought of using CSS animations like this before!
10:28
Kevin Powell
Переглядів 58 тис.