Container Queries are going to change how we make layouts

  Рет қаралды 177,867

Kevin Powell

Kevin Powell

Күн бұрын

Пікірлер: 236
@Defini3
@Defini3 2 жыл бұрын
What every website UI/UX designer saves: *Kevins videos* I swear every videos of this dude is a gem! These are the videos newbies look for and people with experience will search for when they forgot how to do something.
@clevermissfox
@clevermissfox 11 ай бұрын
When I scroll down KPs channel and list of videos, pretty much all of them for the past 2years have been watched all the way through. So grateful!
@zachjensz
@zachjensz 2 жыл бұрын
I cannot contain my excitement!!! Only thing I dislike is creating markup for flex/grid, we should have container-type: flex; and container-type: grid;
@MixbOOsted
@MixbOOsted 2 жыл бұрын
Whyy KZbin 👊👊👊
@KevinPowell
@KevinPowell 2 жыл бұрын
Patron's get my videos 2 days early :)
@cedrictheveneau9141
@cedrictheveneau9141 2 жыл бұрын
I swear Kevin’s channel is a goldmine, it’s just so nice to know I have just one channel to follow to keep up with CSS evolution; thank you for your hard work Kevin !
@georgesaitdev
@georgesaitdev Жыл бұрын
Absolute gamechanger feature! You, mr Powell, are a true legend! Especially these days where every job opportunity screams for React, Vue or Angular, a true frontend spec named CSS is becoming more and more overlooked whilst there is so many development in there. To me personally you really succeeded in your mission keeping CSS fun. Thanks, much much appreciated. 🙌
@slava_trushkin
@slava_trushkin 2 жыл бұрын
Brilliant! This was needed for many years, but better late than never. I've hit this wall with media queries almost a decade ago when I was designing themes for forums, where posts can have sidebars, user profile block and so on, so content could be wrapped in multiple layers of stuff, making it impossible to use media queries. My solution was similar to containers, but with JavaScript that toggled classes on container elements. It was a nightmare to maintain. I don't work with forum themes anymore, but PTSD from attempting to design proper responsive themes still remains.
@metalstarver642
@metalstarver642 2 жыл бұрын
I had similar problems, and currently use ResizeObserver in JS to set CSS variables to a container to be used in CSS.
@summerWTFE
@summerWTFE 2 жыл бұрын
Yeah. I guess humanity has finally reached a state of technology to make it happen.
@davidkonevky7372
@davidkonevky7372 Жыл бұрын
I love your videos because css is so overlooked in the web developer landscape and honestly I think it can become the most fun part of the process if you know how to have fun with it
@archer201977
@archer201977 2 жыл бұрын
The ".super-simple-example" class made me laugh in a good funny way, don't get me wrong i learn many new things from you, even at 16 years in my career there are many things i still don't know yet and some i have forgotten. Thanks to you!
@SameeraAlutwela
@SameeraAlutwela Жыл бұрын
🎯 Key Takeaways for quick navigation: 01:10 📏 Container queries focus on component-based layout adaptation within containers, overcoming limitations of viewport-based media queries. 03:46 🔄 Container queries directly target the nearest container's size, providing more precise responsiveness within components. 07:46 🔄 Named containers enable applying container queries to specific components, allowing for fine-grained styling based on container context. 11:15 📐 Using `size` for container type affects both width and height, requiring careful consideration; prefer `inline size` for most cases. 18:42 📐 Applying container queries within Flexbox or Grid layouts might need additional adjustments due to container behavior; consider the layout structure carefully. 19:50 🛠️ Container queries can be limited by parent grid dimensions; to target individual grid items, use intermediate div containers as parents. 21:10 🧩 When working with flex layouts, applying container queries might require adjusting flex properties to prevent children from collapsing to zero width. 23:18 🧐 Understanding container implications is crucial; they establish new formatting contexts, affect layout behaviors, and eliminate margin collapsing. Made with HARPA AI
@robertwattner
@robertwattner 2 жыл бұрын
I feel like I'm going to be using this A LOT! You're awesome Kevin!
@mandokir
@mandokir 2 жыл бұрын
In 5 years.
@k1mpman
@k1mpman 2 жыл бұрын
Been learning react for a week or two now and I just couldn't find mentions of how people use a component multiple times with different stylings. This solves so much of that for me and it's such a relief that you even mention this in the video because I was going crazy. I ended up thinking most people just use tailwind or something and use the medium, small and large media query for everything. What an amazing video, Kevin.
@glenn_myridia
@glenn_myridia 2 жыл бұрын
Kevin, thanks for the great work and keeping us up to date with the latest CSS features. As a front end developer there is always so much new stuff to keep track of, and having a single reliable place like this to keep up to date with CSS is extremely valuable!
@hotkatgotama
@hotkatgotama 2 жыл бұрын
a
@MegaClockworkDoc
@MegaClockworkDoc Жыл бұрын
Container queries are amazing, but wait, there's more!🎉🎉🎉 Wonderful content, thank you Kevin!
@BoodskiBro
@BoodskiBro 2 жыл бұрын
I've been waiting for this for like 5 years!
@obelisk.5890
@obelisk.5890 Жыл бұрын
I’m deeply and madly in love with css thanks to Kevin.
@Furki4_4
@Furki4_4 Жыл бұрын
The container query and especially range syntax is awesome. I don't think container queries undermine media queries, however they let us to add more complexity which helps websites to be more flexible and responsive ! Thank you Kevin, I can't leave watching your videos everyday for a week ! I... I guess I fell in love with css as a backend developer 🤭
@igordasunddas3377
@igordasunddas3377 2 жыл бұрын
I honestly enjoy your videos a lot. I love discovering new stuff with someone as bespoken as you.
@SownJevan
@SownJevan Жыл бұрын
I just sometimes get back to these videos to get the full picture again. Thanks Kevin.
@GauravKumar-ue7nz
@GauravKumar-ue7nz 2 жыл бұрын
Quality of Content and Quality of Production is Top-Notch
@LePhenixGD
@LePhenixGD 2 жыл бұрын
Hey Kevin, I have a suggestion for your next video, a video about all the important CSS media queries (screen, print, orientation, prefers-color-scheme…)! For the time being, awesome video mate!
@KevinPowell
@KevinPowell 2 жыл бұрын
been planning a media query deep dive for awhile, I should probably get around to actually making it!
@love.ly.
@love.ly. 2 жыл бұрын
Yesss
@tworsfeline2302
@tworsfeline2302 2 жыл бұрын
@@love.ly. Why did my KZbin app translate your comment to have one more "s" when I clicked "Translate to English"? (I am not actually asking you, it's just strange that it happened)
@BlojaCastro
@BlojaCastro 2 жыл бұрын
DAYUMN, next step, editing videos and 3D in minutes
@TheZyruks
@TheZyruks 2 жыл бұрын
This is super cool, hope this get supported by every browser really fast.
@evamotto9276
@evamotto9276 Жыл бұрын
This is sorely needed, I'm about to research browser support 🤞
@helw7
@helw7 2 жыл бұрын
🧡🧡 I love container queries 😊🧡 .. have been waiting for it for years! .. I already implemented it in my free wp plugin (Block Designer) .. actually a polyfill because of browser support 😏 .. I’m so happy this is finally coming! 🥳
@mohammedalhashamy6276
@mohammedalhashamy6276 Жыл бұрын
Hi Kevin! Thanks FOR THIS SERIOUSLY!
@rodbrowning
@rodbrowning 2 жыл бұрын
I would like to say sorry for tell you that your videos wasn't good because was too long. I was passing through some problems at the time and I still do but now I know that I was the problem not you. Your content are great. Please keep helping people.
@27sosite73
@27sosite73 Жыл бұрын
this guy loves css
@Pilosofia
@Pilosofia 2 жыл бұрын
I never heard about container query before but now I will start using it heavily.
@charliecoplestone9694
@charliecoplestone9694 2 жыл бұрын
Genuinely game-changing.
@nro337
@nro337 2 жыл бұрын
The hero we always need. Thank you!
@anth0ni33
@anth0ni33 2 жыл бұрын
When this was showcase for the first time I literally danced for joy
@peteremad5228
@peteremad5228 2 жыл бұрын
amazing explanation simple and easy ..cover all used cases ...thank you
@D7460N
@D7460N 2 жыл бұрын
Straight forward and very helpful. Thank you!
@chazy123
@chazy123 2 жыл бұрын
Those extra classless divs near the end, I really felt that.
@vivekkumar-pc1xy
@vivekkumar-pc1xy Жыл бұрын
Awesome lecture. Thank you so much 🤯
@steveportasUKUS
@steveportasUKUS 2 жыл бұрын
Amazing!! Can not wait to back this into my daily builds!
@leangengaleadsit7299
@leangengaleadsit7299 2 жыл бұрын
Thank you Mike! I'm just starting out and tNice tutorials video really helped get the basics down!
@haousixridei5137
@haousixridei5137 2 жыл бұрын
cam on ad da co nhung bai giang huu ich cho moi nguoi chuc ad luon thanh cong trong moi viec
@noskillzdad5504
@noskillzdad5504 2 жыл бұрын
Awesome content! Thanks for sharing.
@kanejust_in
@kanejust_in 2 жыл бұрын
thank you for the detailed guide, it helped me install this soft
@macx
@macx 2 жыл бұрын
Thanks for sharing this! You become my number one resource for new features, I don't care about the sites you are looking for. ;-) Anyway, working as a front-end for more than 23 years and also being a lecturer for students, this video was hard to follow. It's not because of the new stuff, it's because of your preparations upfront. Without knowing your code, I can't judge what the outcome will be. My suggestions: Build simple markup in the video as well. Using Sass and it's grouping could also help. I have to try it myself this time to understand it completely. And this is different for your other videos.
@msalam4248
@msalam4248 2 жыл бұрын
you are a very good instructor kevin....
@MixbOOsted
@MixbOOsted 2 жыл бұрын
Here is a Unique content Css 💫 kevin Nice 👍👍👍
@Morrile1
@Morrile1 2 жыл бұрын
Improved control is certainly on it's way, and about time too!
@developer_hadi
@developer_hadi 2 жыл бұрын
wtf
@developer_hadi
@developer_hadi 2 жыл бұрын
how did you comment yesterday
@developer_hadi
@developer_hadi 2 жыл бұрын
KZbin BUG🌝
@MixbOOsted
@MixbOOsted 2 жыл бұрын
Againnnnnnnn
@KevinPowell
@KevinPowell 2 жыл бұрын
He's a Patron, so he gets them 48 hours in advance :)
@wfl-junior
@wfl-junior 2 жыл бұрын
next gen css is going to be bonkers
@henriqueaguiar9737
@henriqueaguiar9737 2 жыл бұрын
Hey, Kevin! Do you plan on doing some content on image optimization and how to get your images ready to be used on websites? Thanks in advance and keep up the great work!
@estherjonathan_
@estherjonathan_ 2 жыл бұрын
Really Help.. Kevin pls can you help on this
@eggkookoo
@eggkookoo 2 жыл бұрын
This strikes me as vaguely scam-ish.
@Brechtvdh
@Brechtvdh 2 жыл бұрын
@@eggkookoo One can only try... 😂
@eggkookoo
@eggkookoo 2 жыл бұрын
@@Brechtvdh I mean the "helpline" message stuff.
@dopetag
@dopetag 2 жыл бұрын
@container is the future for responsive typography
@ikbo
@ikbo 3 ай бұрын
Kevin, you need to make a new course on web layouts especially different patterns and how to implement them with modern css. Lots of outdated material out there. Instantly would buy such a course from you!
@KevinPowell
@KevinPowell 3 ай бұрын
Once I finish Beyond CSS, I'll be doing a layout course :)
@bibianomauro
@bibianomauro 2 жыл бұрын
this is amazing
@mj2068
@mj2068 Ай бұрын
tbh, this is pretty awesome.
@zxuiji
@zxuiji 2 жыл бұрын
4:38, while not as convenient as containers you can achieve the same with media queries, if you can do it with old css then you should, then you won't have stubborn mules who use the old **** complaining at you.
@JaderRubini
@JaderRubini Жыл бұрын
GAME CHANGER feature right there, and I’m so glad browser support is very good for this one right now. One thing that came to my mind, specially to avoid dealing with the grid/flexbox issue you pointed out: if you’re breaking your UI up into components, doesn’t it make more sense to make the component’s container itself into a container (that would be .call-to-action in your example)?
@DannyH77
@DannyH77 Жыл бұрын
just wondering did you figure out the answer to this question? I want to know as well
@filippotinnirello
@filippotinnirello Жыл бұрын
8:35 couldn't you assign the container-type directly to aside and article? since container doesn't change anything per se, you could let it be the default behavior for these tags, isn't it?
@mfpears
@mfpears 2 жыл бұрын
I remember trying to explain to people in 2016 why container queries were important. Now it seems like most people get it. It's nice.
@funkdefied1
@funkdefied1 Жыл бұрын
Beautiful
@bobmarteal
@bobmarteal 2 жыл бұрын
at 9:44 i shed a nerd-tear.
@chrisevans5787
@chrisevans5787 2 жыл бұрын
i love your videos, thanks for showing a newb like me awesome stuff!
@octothorpe12
@octothorpe12 2 жыл бұрын
this is gonna take me awhile to wrap my head around.
@nerds6205
@nerds6205 2 жыл бұрын
My inspiration 🤩
@luispato9335
@luispato9335 2 жыл бұрын
Really excited for the container queries, but i am quite sad the the element itself (the container) cannot be styles in the container query, which will make us write unnecessary markup. Such a turn down...
@dArKoMeGa89
@dArKoMeGa89 2 жыл бұрын
We've gone from: Use more divs than you need to style. To: Use div just for markup, use CSS to style the page. To: now we need more divs again, forgot what we said about using HTML for semantic.
@pXnEmerica
@pXnEmerica 2 жыл бұрын
I dunno how you can smile and look at CSS at the same time, lol.
@muck2000
@muck2000 2 жыл бұрын
WORKING thx bro
@fcfc
@fcfc 2 жыл бұрын
all those years of frustration... i wish i had this back then!
@codebycarlos
@codebycarlos 2 жыл бұрын
Hi Kevin, awesome video as always thank you! I was curious as to why you used the data-type attribute to set the container stylings in the beginning. Would it not be more appropriate to have these as classes?
@KevinPowell
@KevinPowell 2 жыл бұрын
More common, yes, but no reason it's more or less appropriate. I've taken that idea from CUBE CSS, and personally I find I like it a lot, using data-attributes as modifiers instead of classes. As long as you have a consistent system, either approach is fine :)
@simon.tomtom.design
@simon.tomtom.design 2 жыл бұрын
Super pertinent video, as always! I was wondering if the container shouldn't be the call to action itself. That way, wherever it's used, it's relying on it's own width to adapt it's style, even if it's not under .content-sidebar.
@simon.tomtom.design
@simon.tomtom.design 2 жыл бұрын
It would also manage the flexbox no?
@KevinPowell
@KevinPowell 2 жыл бұрын
An item can't be its own container. You could have the call to action, as the container and then a div inside it that looks at it, and then all the content in there? Seems like an awkward pattern though
@simon.tomtom.design
@simon.tomtom.design 2 жыл бұрын
@@KevinPowell Ok, I'll dive deeper (it's my first look at Container Queries) but for me, the idea was to make single components responsive wherever they're used and not have to declare rules for every spot you could use the component. Thanks!
@simon.tomtom.design
@simon.tomtom.design 2 жыл бұрын
Ok, I wrote too quickly, it makes more sense the more I look at it!
@AmodeusR
@AmodeusR Жыл бұрын
14:05 I wonder how hard would it be to make the inline-size the first property instead of the second, hence allowing us to use it as a shorthand property without needing to declare both values...
@QwDragon
@QwDragon 2 жыл бұрын
Actually { container-type: size; height: 100%; overflow: auto; } seems very usefull. And it's a bit strange there's no container-type: block-size yet.
@KevinPowell
@KevinPowell 2 жыл бұрын
block-size and some others should come eventually :) The issue with `height: 100%` is we don't always want that either though. But yes, it could be pretty useful in the right situation. In my video where I look at container units coming later this week, I found a few better use cases for dealing with heights :)
@The-Dev-Ninja
@The-Dev-Ninja 2 жыл бұрын
mind-blowing
@felixenghofer4616
@felixenghofer4616 2 жыл бұрын
Thank you so much for that video, Kevin - so well explained as always! I really needed exactly this behavior in the past and was wondering why container queries don't exist. Finally! 🙂
@joshmeurer4956
@joshmeurer4956 Жыл бұрын
I noticed recently that adding container-type to the class of an element seems to be making it z-order on top of an element that is positioned absolute via javascript. I wonder if you have any observations of whether this is expected and if you have any suggestions for how to plan for or manage this?
@jeffkinley3698
@jeffkinley3698 2 жыл бұрын
Hi Kevin. Great demo. I was trying to create a demo of container queries to explain this concept to my colleagues. I used this as a basis for my demo. Also, just curious why you chose to use data attributes for the sizes and not just a classes. Any particular reason?
@Rmoore08
@Rmoore08 5 ай бұрын
It's frustrating to me, but when doing @container (width < 940px), the width it uses is the width of the content box of the element and does not include padding. When padding is applied, it will actually apply the styles when the element (including padding) is less than 957px (padding left and right is 8px). So the only option I see is to modify my container query to take into account the applied padding, which is not great readable code. And if I ever decide I need to change the padding of my container for whatever reason, I'll need to update the query to account for it. Changing the box-sizing property of the container does nothing to change this behavior. It always in relation to the width of the content-box of the container. Frustrating.
@drizzbot2994
@drizzbot2994 2 жыл бұрын
Best of the best
@alexandrudorultan9001
@alexandrudorultan9001 Жыл бұрын
what kind of css you use because for me container-type or any of container property doesn't work can you give me a clue please
@mlookmero1004
@mlookmero1004 2 жыл бұрын
concepts finally line up in my brain and...well, who knows? Maybe I'll be able to make sotNice tutorialng now.
@larmiekeys7338
@larmiekeys7338 2 жыл бұрын
Really work
@mrrolandlawrence
@mrrolandlawrence Жыл бұрын
this could be awesome for items in a gallery... set the background to display an image depending on the container size, not the viewport width. esp if the number of photos in the gallery changes on the width of the grid say.
@AndreGreeff
@AndreGreeff 2 жыл бұрын
Hey Kevin... completely random one: I'm watching your video fullscreen on my right-hand monitor, so it's kinda trippy the way your DevTools window "disappears" off the left of my screen.. I keep half expecting it to magically appear on my left monitor for some reason. (: With that said, it definitely was not distracting though, so don't stress. Very cool video though, thanks for the nice clear presentation.. Container Queries really are incredible, I need to go play in my sandbox now... :D
@jeffb694
@jeffb694 2 жыл бұрын
Thanks for the video Kevin. It worked on Chrome. This didn't work on Firefox. MDN says: "Last updated on 15 September 2021 to add details of the new properties container-type, container-name, and container."
@olisaemekaaghabuilo8688
@olisaemekaaghabuilo8688 2 жыл бұрын
Kelvin this is Awesome...............
@27sosite73
@27sosite73 Жыл бұрын
ty mate
@sajjadkazemi
@sajjadkazemi 2 жыл бұрын
thabk you for this video I really neded it♥️
@StephenRayner
@StephenRayner 2 жыл бұрын
Very cool
@eccenux
@eccenux Жыл бұрын
Good video... But what is with this attribute selectors. Attribute selectors are longer and slower. Why not use: `.container.medium`?
@thangluong2365
@thangluong2365 2 жыл бұрын
I am coming from soft one 4.6 and I am so torn with soft soft. It seems great as it is so in-depth in its' capabilities but, so fiddly to get
@SoulStitch1111
@SoulStitch1111 2 жыл бұрын
sadly, this only made me more confused. A little all over the place. Will have to watch it a third time and slow it down. Thank you for all you do.
@sovereignlivingsoul
@sovereignlivingsoul 2 жыл бұрын
excellent video, a problem solver i hope.
@mohitkamal8124
@mohitkamal8124 2 жыл бұрын
Good video
@xbsidesx
@xbsidesx Жыл бұрын
Would it work with ::before or ::after pseudo selectors? I think not since they don't have children, but that's the way I was thinking about when solving the problem in the flexbox example.
@timseguine2
@timseguine2 2 жыл бұрын
Is there some kind of preprocessor or polyfill for this feature to make it more accessible? Kind of neat, but I don't really find it that useful as is as long as it is not supported in firefox.
@dimitrist.8855
@dimitrist.8855 2 жыл бұрын
What plugin do you use in vscode for auto indentation after saving?????
@louroboros
@louroboros Жыл бұрын
Regarding the 3-card grid layout: Why not set .even-columns > .call-to-action { container-type: inline-size; } ?
@toshchakfox
@toshchakfox 2 жыл бұрын
weird question. does container-type:inline-size break mix-blend-modes of its children? for me it breaks and can't seem to figure it out.
@KevinPowell
@KevinPowell 2 жыл бұрын
Very possible it does, yes, because it sets tthe "contain" property on the layout, as well as styles, so styles from that element cannot "escape" out of it, so mix-blend-mode not working would make sense. One of the side effects we're going to have to live with if we want this to be possible!
@toshchakfox
@toshchakfox 2 жыл бұрын
@@KevinPowell So most likely it's a technical limitation and not just me. Thank you Kevin. I was losing it already. Decided to scrap all container queries and :has selectors from my code and start from scratch. Using them on a real project was not smart 🙂 But it was really interesting nontheless, all thanks to you. Love your videos.
@r-i-ch
@r-i-ch 2 жыл бұрын
This is great! Do you have a codepen for it? (I can see a lot, but not the base styles)
@Sollace
@Sollace 2 жыл бұрын
17:04 Could you use "min-height: max-content;" to fix this, though?
@KevinPowell
@KevinPowell 2 жыл бұрын
nope, cause there is no 'max-content' at that stage, it effectively can't see it's children anymore. This is on purpose, because without doing that, it would be very easy to create recursive behavior with endless loops between 2 states
@Sollace
@Sollace 2 жыл бұрын
@@KevinPowell Oh :( Well okay. That's a shame, but it makes sense. Still a very useful too for laying stuff out.
@mohibuddinahmedumer4738
@mohibuddinahmedumer4738 2 жыл бұрын
it work on my pc thx bro vеry much
@Pjotterism
@Pjotterism 11 ай бұрын
@containter isn't supported in vscode yet, how are you managing to use it ?
@agborjosophine527
@agborjosophine527 Жыл бұрын
Just watched the video but it's the writing isn't clear enough but love the video though i just think you should increase the font size of the letters
@Pjotterism
@Pjotterism 11 ай бұрын
the @container rule is not yet supported in vscode, how do you manage to use it here?
@TufanCalisir
@TufanCalisir Жыл бұрын
Hello, is it possible to get the .html and .css code to dive more in depth with the container queries? Like in codepen or so?
Learn how to use Media queries & Container queries
34:33
Kevin Powell
Рет қаралды 82 М.
5 super useful CSS properties that don't get enough attention
16:23
Kevin Powell
Рет қаралды 149 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
Subgrid & Container Queries change how we can create layouts
21:08
Kevin Powell
Рет қаралды 79 М.
Getting started with CSS nesting
27:14
Kevin Powell
Рет қаралды 75 М.
sqlite-vec: Hybrid Search Event (Oct 2nd 2024)
50:06
Alex Garcia
Рет қаралды 94
Top 10 Advanced CSS Responsive Design Concepts You Should Know
20:16
Web Dev Simplified
Рет қаралды 544 М.
5 simple tips to making responsive layouts the easy way
15:54
Kevin Powell
Рет қаралды 783 М.
Responsive CSS Will Never Be The Same
12:08
Web Dev Simplified
Рет қаралды 270 М.
:has() opens up new possibilities with CSS
14:30
Kevin Powell
Рет қаралды 289 М.
My top 5 most popular front-end tips
22:07
Kevin Powell
Рет қаралды 69 М.
Using CSS custom properties like this is a waste
16:12
Kevin Powell
Рет қаралды 184 М.
The problems with viewport units
13:23
Kevin Powell
Рет қаралды 368 М.