Тёмный

A new approach to container and wrapper classes 

Kevin Powell
Подписаться 912 тыс.
Просмотров 242 тыс.
50% 1

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 RU-vid 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!

Опубликовано:

 

31 май 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 599   
@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!
@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!
@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 :)
@CyberTechBits
@CyberTechBits 2 дня назад
No @media queries for all the different screen widths, including mobile, is PRICELESS!
@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 4 месяца назад
containers are for more clear than this...
@feba33
@feba33 10 дней назад
@@Dead_Goat you’re crazy Is far easier than 20 nested divs
@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 6 месяцев назад
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 3 месяца назад
I thought XHTML was gonna be the coolest thing in 2005. I loved the idea of really pure HTML.
@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!
@VilleTakanen
@VilleTakanen 6 месяцев назад
As a person who also occasionally does paper layouts - I love this. It's a very analog approach to page grid ❤
@AmodeusR
@AmodeusR 6 дней назад
It's really amazing, it's very good to know I have an alternative to containers!
@omgnowairly
@omgnowairly 6 месяцев назад
This is pure gold. For markdown formatting or user submitted content, this allows a new level of presentation.
@AmyDePalma
@AmyDePalma 6 месяцев назад
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.
@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.
@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.
@adammarostica3016
@adammarostica3016 6 месяцев назад
I absolutely love this! Set it up once and then you’re set. This is brilliant. Thanks, Kevin!
@CyberTechBits
@CyberTechBits 2 дня назад
This is AMAZING! I cannot wait to use it in prod for my next project! Thanks Kevin!
@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.
@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); }
@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. 😄
@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.
@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!
@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
@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!
@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.
@abramthau558
@abramthau558 6 месяцев назад
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!
@joaquingarcia7075
@joaquingarcia7075 6 месяцев назад
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.
@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!
@JoseMVelazquez
@JoseMVelazquez 6 месяцев назад
Anything that reduces the excesive use of container divs we see these days is a welcome change for me.
@zizak143
@zizak143 4 месяца назад
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
@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.
@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.
@JasonDuerrPDX
@JasonDuerrPDX 6 месяцев назад
Elegant *and* flexible. I'll be swiping a handful of things from this one. Thanks Kevin! Great work as always.
@cubbucca
@cubbucca 6 месяцев назад
love how this covers every screen size without the need for @media
@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.
@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.
@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.😅😊
@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.
@BMikel
@BMikel 6 месяцев назад
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.
@thatianallen
@thatianallen 4 месяца назад
I think this is a really cool approach. Cleaner HTML and less media queries, WIN!
@tictac1020
@tictac1020 5 месяцев назад
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.
@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.
@Akshatgiri
@Akshatgiri 6 месяцев назад
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.
@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! 🔮
@aje9633
@aje9633 6 месяцев назад
this one is a lifesaver.!!! Literally, it got my mind blown that this could be possible.
@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!
@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!
@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 !
@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 :)
@kobi-kobsen
@kobi-kobsen 6 месяцев назад
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!
@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
@melissafrasik9272
@melissafrasik9272 6 месяцев назад
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!
@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!
@aleksandraurbanek9966
@aleksandraurbanek9966 6 месяцев назад
I think it's great! Now I can easily choose which element should be wider or not!
@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 🙌🙌
@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
6 месяцев назад
This is an amazing idea for CDN documents used in different platforms or CMS used by content creators who don't have the time or patience to understand and learn HTML and CSS. Less HTML voodoo for content creators, more fun for front-end devs!
@NathanChase
@NathanChase 6 месяцев назад
I really like this, and my mind immediately jumps to setting a 'container-type: inline-size' on the 'main', and then setting padding and max-widths as units of cqw, rather than rems or ch units. Then you can set a single width for the whole container and everything underneath will automatically, perfectly scale. --padding-inline: 10cqw; --content-max-width: 50cqw; --breakout-max-width: 60cqw; container-type: inline-size;
@petrmotejlek1427
@petrmotejlek1427 5 месяцев назад
Love at first sight :) I began using css back when they tried to get rid of display/visual HTML tags such as b and I, because HTML was supposed to be display-agnostic (if anyone still remembers the Zen Garden site, that's from that time). Still, they kept div and span around. Exactly because you had to use them as containers. As, back then, you could not do it any other way (except maybe for js, but some people had js blockers installed back then :)), it made sense. I haven't had the pleasure of doing "new css" in a while. But am already looking so much forward to it :). The fact you don't need lessc or scss to do calculations and such, that's just perfect. Cant wait to begin upgrading my old projecte.
@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.
@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 :)
@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.
@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!
@simondann7371
@simondann7371 4 месяца назад
I have serendipitously stumbled upon your video at the very time I needed it; thank you!
@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!
@saroule
@saroule Месяц назад
This is very cool, I see no problem to also use some device breakpoints too. Thanks!
@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?
@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
@boby4751
@boby4751 5 месяцев назад
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.
@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
@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
@HeyDanThomas
@HeyDanThomas 6 месяцев назад
Love this! I've thought for years there should be a less divitis way to achieve these things. Thanks for sharing.
@CanRau
@CanRau 6 месяцев назад
Used this couple of years ago on my personal blog. And right now re-evaluating for current project 🤓
@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.
@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.
@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 😊
@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.
@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.
@iskimo01
@iskimo01 6 месяцев назад
You just made me rethink the whole concept of grids!
@crowebro9581
@crowebro9581 28 дней назад
I love this. I can see myself using this method quite a bit.
@JohnDoe-jc4xp
@JohnDoe-jc4xp 6 месяцев назад
❤ this solution, I want to go back to my old projects in retrofit this into them. 😮
@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!
@palmpixiplus
@palmpixiplus 6 месяцев назад
This is awesome! I've mostly been using flex because grid never really 'clicked' for me. But now it's starting to make more sense. I also found that I could do sub-columns by adding more template areas and using nth child to put things in the right sub-column. ( For example, putting a thumbnail next to a half width column ).
@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 😄
@wecm8991
@wecm8991 6 месяцев назад
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!
@danha3107
@danha3107 4 месяца назад
I’m just a student with not that much industry experience yet but oml one of the things that bugged me most about web dev is the constant use of wrapper divs in html lol. Felt so unnecessary but I didn’t know anything better, and I really want to stay as close to the “HTML describes structure/content” ideal as possible without too much clutter just to enable other things. This is super nice and helps keep the jobs of HTML and CSS truly distinct while still being powerful and even portable!
@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.
@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!
@artboeckchen1247
@artboeckchen1247 6 месяцев назад
I really like this approach. It's much tidier and logical for me. It preserves the semantics of HTML much better.
@jordondavidson3405
@jordondavidson3405 6 месяцев назад
Honestly, this looks like a great starting point for a layout system, especially for a component-driven cms. When working in a Bootstrapesque system with a "container" div, landing pages are particulary hard to create when you need to mix full-width and contained elements. This is a very elegant solution to that use case.
@wireinet
@wireinet 6 месяцев назад
Incredible idea! I will start то use it! Incredible. Very customisable!!!
@WesRuvalcaba
@WesRuvalcaba 6 месяцев назад
Mind blown. I hate HTML markup that only exists for styling, and I think this is an intuitive and useful way to avoid a lot of that. So far I haven't cared about naming grid things, only me about areas, but making grid lines for this purpose seems way more intuitive and useful.
@nicesoul
@nicesoul 6 месяцев назад
Totally agree!
@TreeborXL
@TreeborXL 6 месяцев назад
@KevinPowell - I have been using dynamic padding left and right to solve this problem for a long time, something like: .padding-700 > * { padding-left: max(clamp(15px, 5vw, 60px), calc(50% - 350px)); padding-right: max(clamp(15px, 5vw, 60px), calc(50% - 350px)); } The above CSS would give a 700px width to all the sub content. I feel this gives a much better responsive solution. In the case you were looking at you would only need three classes to achieve the same result, no extra div and no media queries. FYI, I use padding left/right as I often want to add padding top and bottom via a different class.
@MattPriour
@MattPriour 6 месяцев назад
Really love this approach! Thanks for showing it.
@vitaliilabunets6193
@vitaliilabunets6193 6 месяцев назад
Awesome! Thnx for step by step exploration. Definitely useful staff
@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.
@Sebeklis
@Sebeklis 6 месяцев назад
Its amazing, I never thought so in the context of the grid, and it is, after all, so obvious
@NikolaFilipovski94
@NikolaFilipovski94 6 месяцев назад
It is a bit complicated to set it up, but like you said, from project to project just copy/paste and eventually change custom properties, it's actually really good to use. Definitely will play with it a little bit :)
@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!
@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!
@AgentProvocateur42
@AgentProvocateur42 6 месяцев назад
This approach keeps your HTML clean and tight - really nice for accessability.