Subgrid & Container Queries change how we can create layouts

  Рет қаралды 75,821

Kevin Powell

Kevin Powell

Күн бұрын

Пікірлер: 109
@gauravkumawat5811
@gauravkumawat5811 11 ай бұрын
It's been 2 years since I started following your channel & I never regretted doing so. I just feel blessed having such a great teacher by my side❤❤. Lots of love to you Kevin. May you get 20M subscribers on KZbin. Keep up the good work. Supporters like me will always be by your side😊😊
@MattDunlapCO
@MattDunlapCO 11 ай бұрын
@KevinPowell this is the best subgrid demo I've seen to date. I think a "can-i-use" video explaining how to decide when a new feature is safe to use would be helpful. Also, maybe a regular segment just reviewing the state of features we're waiting on (color-mix, subgrid, container queries [size and props], anchor positioning) from relative usage to feature ticket progress would be amazing.
@KevinPowell
@KevinPowell 11 ай бұрын
So glad that you enjoyed this one :D - Also, a quarterly check-in on the state of new CSS features could be a good idea!
@clevermissfox
@clevermissfox 11 ай бұрын
Gah anchor positioning is gonna be 🔥
@Dunktastic17
@Dunktastic17 11 ай бұрын
Very exciting to see all these new CSS features in action! Awesome tutorial!
@daveden2
@daveden2 11 ай бұрын
wow, I never thought about using the grid-auto-rows like that... coupled with the subgrid. I'm learning a lot from Kevin every day
@MM_Sheehan
@MM_Sheehan 11 ай бұрын
One of the best things about watching these videos is catching Kevin's excitement about new features. Don't ever change.
@safie01
@safie01 9 ай бұрын
Que satisfatório ver os items se ajustando, ver tudo funcionando assim me deixa "🥺 I'm amazing".
@winningtech5
@winningtech5 11 ай бұрын
love how he uses, the latest css properties now. i watch your videos but when i start coding i forget about these new features and fall back to the old way i write css.
@vlad_gabor
@vlad_gabor 11 ай бұрын
I've been using flex for most of my work but after seeing this video I might switch to grid and containers. Awesome work you've done!
@igordasunddas3377
@igordasunddas3377 11 ай бұрын
Same actually. I really think I have a good understanding of how to get stuff to display nicely using flexbox, even for RTL languages, but this looks very interesting and promising and when I finished the video, I definitely wanted to give another thumbs up to it. Awesome work, Kevin!
@amaury_permer
@amaury_permer 11 ай бұрын
Is funny that I was working with subgrid yesterday in a similar way and then you upload a video about the same, great content as always!
@darvil82
@darvil82 11 ай бұрын
I never knew how powerful subgrid was until now. Thank you!
@the3rdchief
@the3rdchief 11 ай бұрын
If you watched this video, not knowing what to expect... gather here, please😅
@CynthiaNicera
@CynthiaNicera 11 ай бұрын
Same here... I searched "learn Css with Kevin Powell" and I got this.. haha let me learn and see what it's got😎
@shineLouisShine
@shineLouisShine 10 ай бұрын
To be honest, it rarely happens, that I'm clicking a 'Clickbait title' (such as "Game Changer" in this case), and think that the bait was justified. This one is different in that regard. So... Yeah... I didn't know what to expect but I'm very pleased being tempted to land here because the content is truly informative.
@danielgago-sk
@danielgago-sk 11 ай бұрын
Perfect. Subgrid and 100dvh ist perfect solution for many of my problems with design or displaing web page on mobile devices... 👍
@clevermissfox
@clevermissfox 11 ай бұрын
Would love some context and a demo on animating grid some day!
@lukedorny
@lukedorny 11 ай бұрын
I love adding a :last-child {margin-top: auto} to force the price section, for example, to balance out the layout when all cards are the same height. Great video.
@yickysan
@yickysan 11 ай бұрын
Came from a data science background and fell in love with fronrend because of you.
@mkm_
@mkm_ 11 ай бұрын
Really great demo of subgrid and container queries, just the memory refresher I needed. Looking forward to using these features now that they are better supported.
@Shaheer-xs5os
@Shaheer-xs5os 11 ай бұрын
This man is awesome, he always have something new
@jadinethomas8935
@jadinethomas8935 11 ай бұрын
Thank you!!! No more hecking around with Matching heights with JS.
@PacificDev
@PacificDev 11 ай бұрын
I am always amazed by your videos🎉
@CZghost
@CZghost 11 ай бұрын
This is so useful for my sharepoint subsite in the making. Thanks.
@ronpalmer7260
@ronpalmer7260 11 ай бұрын
I had this issue with my blog post cards. I got it to all line up but it took a lot of guess work and trial and error. I like this solution.
@daveturnbull7221
@daveturnbull7221 11 ай бұрын
Miriam Suzanne gave a great explanation/demo of when and why some parts of CSS break over on Learn With Jason. Really interesting talk about how the whole CSS Working Group thing works.
@VasilyPavlik
@VasilyPavlik 11 ай бұрын
Ohhhhhh. After each of your videos I walk for hour or two around and think how I can use this knowledge. But today I was searching for this knowledge in many places. And only place I've found all answers is here. How did you know what I wanted?
@bopuc
@bopuc 11 ай бұрын
1. Amazing. As someone who had to hack hundreds of layouts in tables back in the days, this is truly tears-of-joy inducing. 2. Do you have Chromium, WebKit and Gecko running in your brain?! The speed at which you do this is like you are rendering everything in your mind's eye before you type it in haha. (Of course I don't imagine you just start the camera and record but really prep these so you're ready, but still…) ;)
@tomapedersen
@tomapedersen 11 ай бұрын
Around two years ago I was implementing almost the exact same design (image of various height on top, two text boxes with unknown number of lines). Firefox had subgrid then, and I was looking at it while implementing some ugly Javascript and cursing. Very pleased that subgrid is in all browsers now.
@anarchodin
@anarchodin 11 ай бұрын
If it's not useful to ad-tech offering, Chrome is slow to adopt. :)
@shineLouisShine
@shineLouisShine 10 ай бұрын
Great stuff. Thank you
@clevermissfox
@clevermissfox 6 ай бұрын
Note- container-type: inline-size is incompatible with subgrid; they cannot be on the same element
@ainschy
@ainschy 11 ай бұрын
Thx, looks great for the future of css design
@aram5642
@aram5642 11 ай бұрын
Form layouts will also get simpler, esp. those split into columns with labels on the left
@jfftck
@jfftck 11 ай бұрын
I am so happy for the focus on layouts in CSS instead of the visual aspect - animations, shadows, masking, etc… This was one of the arguments for CSS when it was first introduced, but then I started to feel that the CSS working group was losing focus. Now that layout is more of the focus, I am getting excited about CSS again.
@zsoltoroszlany7172
@zsoltoroszlany7172 10 ай бұрын
I'm so angry to myself because everything is easy, I understand. But when I need to work with grid, subgrid etc. everything, my knowledge just vanishes. It is frustrating but maybe if I'm going to spend more time with it, it will stick. Thank you @KevinPowell for the greate tutorial.
@wojciechbajon
@wojciechbajon 11 ай бұрын
finally I'm understand subgrid
@bentoth4324
@bentoth4324 10 ай бұрын
If you are using webpack (or worse, Safari) you can use: grid-template-columns: repeat(auto-fit, minmax(calc(min(100%, 180px)), 1fr));
@altaccount648
@altaccount648 11 ай бұрын
I wish CSS had better nesting like SASS, honestly the only reason I don't want to use plain CSS is the below-average nesting.
@tonyr.6637
@tonyr.6637 11 ай бұрын
Brilliance all around! Nice to see such a great combo of subgrid and container queries and native CSS nesting! Thank you 🙏🏽
@KevinPowell
@KevinPowell 11 ай бұрын
Thank you so much! Really generous of you!
@adeisaac
@adeisaac 11 ай бұрын
I officially crown thee, "King of CSS" 👑👑👑👑👑
@parahumanoid
@parahumanoid 7 ай бұрын
Dear Kevin and fellow subscribers, if I recall correctly, it was once mentioned in the channel, that DIV is inline according to spec, but block by default browser styles - unanimously. If so, would you please be so kind as to hint where I can confirm the specification default display type for DIV? Thank you.
@eccenux
@eccenux 10 ай бұрын
This is a bit of a nit picking comment, but something others may learn from. To get a better structure and wcag/a11y: the product divs should probably be sections with a header on top of the section or with `aria-labeledby`. I know that Kevin probably knows that as he shown good knowledge of a11y in the past 🙂 and in this case it would probably complicate the example. But something worth knowing that the grid in that structure and layout would be a bit "awkward" for screen readers 😉
@djmtype
@djmtype 11 ай бұрын
Would it be better to use 1/-1 on product row instead of span 3? For example, if you were to introduce another element on the product card, the grid would break because it would need to span 4 rows.
@orbitory7936
@orbitory7936 10 ай бұрын
Can you talk more about container queries, support for them and how can we add support for browsers that don't have it?
@ScottMackey
@ScottMackey 11 ай бұрын
Another great video Kevin! Wonder what has changed so that CSS is making so many great changes/enhancements at a fast pace? Given that for over a decade we was stuck with floats for positioning. 🤣 Thanks again.
@erickmoya1401
@erickmoya1401 11 ай бұрын
IE was deprecated.
@ScottMackey
@ScottMackey 11 ай бұрын
@@erickmoya1401 yeah kinda weird that we have some form of standards now too.
@shankar99977
@shankar99977 11 ай бұрын
@KevinPowell this is amazing... why you don't make videos on "float"? Could you please make video on floats? I watched your old one too...
@jacobharvey2946
@jacobharvey2946 11 ай бұрын
I haven’t tried it in a decade… I wonder how all this modern grid stuff would play out with my flexible SVG project I had back in the day. Effectively it was what you see a lot of sites do with their logo (shrinking it when the page scrolls) on steroids. I based the testing on a another, popular experiment at the time that basically used a sprite sheet. I used the object element and CSS connected to the SVG to resize and manipulate logo(s). The object tag allowed for a sort of sub-page effect. End result was whatever the dimensions of the wrapping element affected the SVG.
@jacobharvey2946
@jacobharvey2946 11 ай бұрын
More unrelated, but the first thing I actually thought of when this popped up. I wish I could convince my only freelance client to be more “flexible” with one of the pages on their site. It’s basically a press page where two page spreads, magazine covers, and web articles all live together. Naturally it’s a grid of items. But with all the variations on image sizes, sometimes it being 2 side by side images, and the client’s requirement none of them can be cropped, it’s a pain to deal with. And of course, new, varying sized items, reflow the page and I periodically get asked if there is another way to do it. Every solution I’ve come up with is slapped down. Long story short, they want a flexible layout for the modern web, while somehow also having pixel perfect precision, using varying sized elements. 🤦‍♂️
@clevermissfox
@clevermissfox 11 ай бұрын
How did I not clock that container queried can be nested within a certain selector. I had also just been wondering if a grid items container would be the main wrapper OR it’s specific cell (since width: 100%; ends up being in relation to the cell not the main wrapper) good to have clarification thank you!
@pharmokan
@pharmokan 10 ай бұрын
great vid. but I hate how the cards cut off the image, is there any workaround for that?
@spatialoptic
@spatialoptic 11 ай бұрын
Thank you so much
@Asyncsprice
@Asyncsprice 11 ай бұрын
I loved your part in the scrima front end dev career path!! Do you have any plans to put another little course on there? maybe involve CSS variables or some of this sub-grid stuff!! would be awesome. Any way happy developing!
@KevinPowell
@KevinPowell 11 ай бұрын
Really glad that you liked it! Right now I don't have plans for new material there though. It's not a *never* type thing, but nothing planned
@LaughingInCorner
@LaughingInCorner 10 ай бұрын
This is great
@CarlosBronze
@CarlosBronze 10 ай бұрын
oh wow Subgrid is now Global 79.34% on caniuse. thats in 10 days!
@qassimahmed1791
@qassimahmed1791 11 ай бұрын
Hello i have a question, why does the body or a main or some kind of container gets a height of 0, even though there are contents inside, but they appear outside in the inspection Or even sometimes the body does not take the full width of its content, in other words the whole page or so, What i want is a way to make sure all my content stays inside their respective containers, and inside the body
@nikilragav
@nikilragav 11 ай бұрын
7:05 so that first row of cards where the text is wrapping onto a second line is actually taller than the second row where the text isn't wrapping, right? What if I want every card to be the same size (big enough so that none of the text overflows
@onitech38
@onitech38 7 ай бұрын
Hello @kevinPowell. I'm learning html and css in my own, and I'm having a lot of troubles when personalizing the page...on the styling part😅...can you help me
@Hobbitstomper
@Hobbitstomper 11 ай бұрын
Chrome: Hold my beer. Firefox: Wait, where's my beer?
@heavylog1c
@heavylog1c 11 ай бұрын
Grids are overcomplicated. Still using flex. Container thingy is pretty cool though.
@webdeveloper4742
@webdeveloper4742 10 ай бұрын
Kevin keep your volume levels the same in each upload as Google doesn't like variable levels.
@djkomp3tenz
@djkomp3tenz 5 ай бұрын
When I don't need the Aside Element and I want it to be Responsive and in the Center with in 480px what should I do?
@scottfwalter
@scottfwalter 11 ай бұрын
Safari seems to have an issue with: grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); Any thoughts?
@paulab9310
@paulab9310 11 ай бұрын
Kevin I really liked this tutorial and it made me go for subgrid to align the lines of a list of articles. The only issue I have is what happens when you want this card elements or products in your case to be wrappend in an a tag. I want people to be able to click on a the card and be redirected to the actual article. I've sent the a tag for now for the title and the paragraph but it makes my HTML not very DRY. Any suggestions?
@danielgago-sk
@danielgago-sk 11 ай бұрын
js can control clicks on any element or entire block
@timgreller
@timgreller 11 ай бұрын
there is nesting in default CSS now??? How did I miss that lol I already knew and used sub-grid, I know about the container queries for some time now. But I was so expecting the code not to work when you started nesting the CSS selectors in a normal CSS file. I was wondering how long it will take you to realize that you are in a CSS not SCSS file. But then it just worked 😂
@girabbit
@girabbit 11 ай бұрын
So the subgrid means that an element that spans multiple columns or rows has its children obey the parent grid. Is that right?
@sawilliams
@sawilliams 11 ай бұрын
Kevin, How do you know all this stuff!!!!?
@teacherrameshkumar
@teacherrameshkumar 11 ай бұрын
At this point of time, could one just rely solely on grid/sub-grid alone and forget about float, flexbox etc?
@olesejus
@olesejus 11 ай бұрын
Nice demo. However this type of problem its still easy to solve with other solutions. But subgrid will be super useful with tables. Where column width should be dynamic depends on text length. Now to do that is only possible with where table have its own styling problems. Flex would give you different cell length per different row. And with bigger projects there is always many tables. Most common solutions to that is to use event does not look good. Use JS to dynamically count cell width, but becomes slow. Would be interesting if you try to play and maybe demo solutions in some other demo ;)
@KevinPowell
@KevinPowell 11 ай бұрын
How would you solve this problem without subgrid? For the image height, it would work, but not for the lines of text that are either 1 or 2 lines that I had on my titles :) - I'm not sure why we'd need subgrid in a table though, and not just a regular grid? 🤔 - And if we do change the display property of a table we have to be careful because it strips all the semantics of the table away the instant we do that, so we need to add everything back using aria roles (which we can do with JS, manually would be a nightmare).
@olesejus
@olesejus 11 ай бұрын
@@KevinPowell price field in this demo is fixed height. so any flex or grid option with flex: 1 or fr1 for middle header field works fine. I understand the idea you wanted to explain. But that would be more noticeable for traditional horizontal table where you need to sync column width.
@calyodelphi124
@calyodelphi124 11 ай бұрын
This will depend on the contexts in which you use when you don't want to use it, because if you need to arrange tabular data, it is always an accessibility best practice to use the tag so that screen readers for the sight-impaired will function properly when reading the contents of the page to the user. But if you're arranging content in some kind of griddy way where we might previously have used or even the 960 grid framework, then the CSS grid module is definitely the way to go.
@JasonJA88
@JasonJA88 11 ай бұрын
The mobile support is a little better than what is shown on 'Can I use.' On iOS, most browsers are just reskinned Safari, while on Android, Chrome is under the hood.
@KevinPowell
@KevinPowell 11 ай бұрын
On iOS every browser is reskinned Safari, as they all have to use webkit. On Android, however, that isn't the case, the can use their normal engine. A lot of the time for mobile, the most important number to look at is when iOS gained support for it, since it's directly linked to the version of iOS, you can know what devices support it or not.
@brandonwebb474
@brandonwebb474 11 ай бұрын
Hi Kevin!
@KevinPowell
@KevinPowell 11 ай бұрын
👋
@albertjoanagramontesuero5290
@albertjoanagramontesuero5290 11 ай бұрын
Hi
@KevinPowell
@KevinPowell 11 ай бұрын
Hi!
@peterl0815
@peterl0815 11 ай бұрын
Very cool ... but I don't want to change or debug it a half year later ;-)
@rijine
@rijine 11 ай бұрын
Cool..
@hugodemenez
@hugodemenez 11 ай бұрын
Awesome
@katlegomonama5824
@katlegomonama5824 11 ай бұрын
css king
@rand0mtv660
@rand0mtv660 11 ай бұрын
It's unfortunate that subgrid has only started to gain traction recently. If other browsers implemented it in 2019 when Firefox did, world would be a better place now
@KevinPowell
@KevinPowell 11 ай бұрын
100%, but better late than never 😅
@muhammadusmanakram406
@muhammadusmanakram406 11 ай бұрын
i did not get grid/subgrid at all
@cykonetic
@cykonetic 11 ай бұрын
Nested tables led to a revolution in CSS which now introduces "subgrid"... looks a lot like nested tables to me ...
11 ай бұрын
While impressive I find the whole construct very complex to achieve the effect. You have various styling across multiple elements which for me hurts readibility and maintenance. I personally would avoid subgrid due to this tight coupling. I think 7 out of 10 front end developers would probably balk at maintaining this css while full stack developers would probably not touch it.
@KevinPowell
@KevinPowell 11 ай бұрын
Subgrid is definitely a trade off, you get more control. I could have done the same thing though, without the `grid-auto-rows` and instead simply given the images an actual height and we'd have the same result, but I wanted to explore an alternative. They are much simpler to use in columns than rows though, imo.
@AdrianCBlack
@AdrianCBlack 11 ай бұрын
is there a pen with this exmple on codepen?
@AdrianCBlack
@AdrianCBlack 11 ай бұрын
found it 😀
@grinsk3ks
@grinsk3ks 11 ай бұрын
good as an example, but I wouldn't do that in real world. It's against component based design.
@moshpat86
@moshpat86 11 ай бұрын
GUNDAM ❤️
@confused_horse
@confused_horse 11 ай бұрын
What happened at 2:41?
@KevinPowell
@KevinPowell 11 ай бұрын
Just a bit of an awkward cut :)
@confused_horse
@confused_horse 11 ай бұрын
@@KevinPowell absolutely great video though! In fact, I've just wasted an hour of everyone at work discussing the concepts you've shown.
@qeqsiquemechanical9041
@qeqsiquemechanical9041 11 ай бұрын
humanity already has quantum computers with its own cryptography, and webdevs still can't solve div centering and arranging. imagine being so screwed up as a field
@Dead_Goat
@Dead_Goat 7 ай бұрын
Ehh not really considering you should never use grid, or grids period. We stopped using tables a LONG time ago please do not go back.
@GrimChu69
@GrimChu69 11 ай бұрын
These hacky solutions is why css is so frustrating...
@calyodelphi124
@calyodelphi124 11 ай бұрын
WHAT IS THIS WITCHCRAFT THIS IS SO COOL 8D
@gknt7234
@gknt7234 9 ай бұрын
One of the best CSS videos in 2023. It's like a recap video, Google should use this on their websites!
@rahul9704
@rahul9704 11 ай бұрын
Subgrid was one my most wished for feature since grid landed
@zinodavidoff5953
@zinodavidoff5953 11 ай бұрын
👑
Container Queries are going to change how we make layouts
24:24
Kevin Powell
Рет қаралды 174 М.
10 Tailwind Tricks You NEED To Know!
10:45
Ravi - Perfect Base
Рет қаралды 294 М.
Bike Vs Tricycle Fast Challenge
00:43
Russo
Рет қаралды 95 МЛН
WORLD BEST MAGIC SECRETS
00:50
MasomkaMagic
Рет қаралды 52 МЛН
отомстил?
00:56
История одного вокалиста
Рет қаралды 7 МЛН
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 14 МЛН
5+ CSS Features That Will Change How You Code
17:58
Web Dev Simplified
Рет қаралды 44 М.
Creating a robust grid system using subgrid
36:22
Kevin Powell
Рет қаралды 44 М.
A new approach to container and wrapper classes
25:27
Kevin Powell
Рет қаралды 259 М.
Getting started with CSS nesting
27:14
Kevin Powell
Рет қаралды 72 М.
5 useful tips to help you improve your CSS TODAY!!
9:02
CSS {de}Coder
Рет қаралды 669
Learn CSS Grid the easy way
37:04
Kevin Powell
Рет қаралды 911 М.
5 super useful CSS properties that don't get enough attention
16:23
Kevin Powell
Рет қаралды 145 М.
How to escape the container on only one side
28:48
Kevin Powell
Рет қаралды 49 М.
Flexbox or grid - How to decide?
18:51
Kevin Powell
Рет қаралды 728 М.
The new CSS pseudo-classes explained - :is() :where() :has()
13:50
Kevin Powell
Рет қаралды 138 М.
Bike Vs Tricycle Fast Challenge
00:43
Russo
Рет қаралды 95 МЛН