Container queries - Designing in the Browser

  Рет қаралды 36,556

Chrome for Developers

Chrome for Developers

2 жыл бұрын

Container queries are an experimental API that unlocks intrinsic component-level styling based on an element’s containing parent. This episode goes over how to use container queries, to highlight the responsive possibilities of tomorrow.
Container Query Polyfill → goo.gle/3Gn9UUO
CSS Container Queries on MDN → goo.gle/3ogyIrp
Simplified Container Query Demo → goo.gle/3lxbb3P
Podcast Card Demo → goo.gle/2ZRxdGY
Plant Store Demo → goo.gle/3G831GR
Baby Clothes Demo → goo.gle/3GdVYwB
Container Query Spec → goo.gle/3ok42pw
CSS Tricks post on @container → goo.gle/3rvGkIB
Web.dev article on containment → goo.gle/3wBMB52
Catch more videos from Designing in the Browser → goo.gle/dib-chrome
Subscribe to Google Chrome Developers → goo.gle/ChromeDevs
#DesigningInTheBrowser #Chrome #Developer

Пікірлер: 49
@yahayaoyinkansola8258
@yahayaoyinkansola8258 2 жыл бұрын
Container queries are so powerful, they really do what media queries can't do and I like that they can scope a css declaration to a specific component without having to worry about it affecting your whole UI, love it! can't wait for browser support
@VarunGupta3009
@VarunGupta3009 2 жыл бұрын
This is so cool. It makes web components so much more re-usable, dynamic, and natural.
@swampflux
@swampflux 2 жыл бұрын
😗 There's a new Chrome Dev Video 😯 Una's in it! 😲 It's about container queries!! 😵 container query based unit values!!!
@KennisKids
@KennisKids 2 жыл бұрын
Can't wait to use it! So excited!
@LuisVazquez-br5zf
@LuisVazquez-br5zf 2 жыл бұрын
Truly next level. Thanks to all involved in this project.
@patricknelson
@patricknelson Жыл бұрын
The “Add to cart” button here is a perfect example of the power of this abstraction and why it’s so useful to allow elements (or components) to only be concerned with the size of their container instead of only be able to use the full viewport. It’s a _huge_ improvement and I’m excited to see that browser support is improving on this every day.
@Zarfin
@Zarfin 2 жыл бұрын
I have waited so many years for this
@daywisonsilva4048
@daywisonsilva4048 2 жыл бұрын
Awesome how container queries changed the web development, I love so much!! 😍
@srikark3532
@srikark3532 2 жыл бұрын
Amazing feature, makes developers life easy.
@petarkolev6928
@petarkolev6928 2 жыл бұрын
Amazing! Thank you, Una 💖
@gotophotoarchive9131
@gotophotoarchive9131 2 жыл бұрын
First time on channel, good topics. Looking forward for more...
@mc-ty4br
@mc-ty4br 2 жыл бұрын
Thank you. That was pretty informative. Looking forward for them to become stable on major browsers
@Radical_Dreamer
@Radical_Dreamer 2 жыл бұрын
You have become the queen of CSS!
@RodyDavis
@RodyDavis 2 жыл бұрын
so excited about this feature!
@leopolon
@leopolon 2 жыл бұрын
amazing!
@georgie2022
@georgie2022 Жыл бұрын
On 11:30 why did she specified the same container-name for .cart-button too, but without container or container-type? And why do we need it, if we still can specify the styles for .cart-button within @container query section and it will be applied?
@alexr.4409
@alexr.4409 2 жыл бұрын
This is really amazing!
@hitendobariya7824
@hitendobariya7824 2 жыл бұрын
Yes
@AcmadHidayat-hs3sz
@AcmadHidayat-hs3sz 10 ай бұрын
Ok
@RATANAGARWALITINFORMER
@RATANAGARWALITINFORMER 2 жыл бұрын
good info maam
@adultbeginner695
@adultbeginner695 2 жыл бұрын
Does it help with CLS?
@CarlosAraya25
@CarlosAraya25 2 жыл бұрын
Is there a way to clamp the minimum size for a container? Would clamp() or min() be a good solution?
@UnaKravets
@UnaKravets 2 жыл бұрын
Yep! You can clamp the parent! Either with min-width/max-width or width: clamp(). We do this on the former on the designcember site
@hiren0707
@hiren0707 2 жыл бұрын
Can it trigger some infinite loop if I write some bad css. Is it possible that when a container break-point is hit its child changes in such a way that they in turn changes the size of a container? I write, when container max-width 200px { .child-div { width: 400px } } when div max-width: 400px { .child-div { width: 200px } }
@normanejm
@normanejm 2 жыл бұрын
Ok, What I understood... Is a CSS Component (UI).. right??
@nelsonmichael4519
@nelsonmichael4519 2 жыл бұрын
Hi, this was an awesome video. I tried checking out the examples on canary, but they don't seem to be working, what could be the problem?
@UnaKravets
@UnaKravets 2 жыл бұрын
There was a spec change to add a size() function requirement that has since been reverted
@nelsonmichael4519
@nelsonmichael4519 2 жыл бұрын
@@UnaKravets yes this is true, I found out that the examples worked after adding the size function. Just to be clear, when you say reverted, do you mean it’s no longer in use? Because it still works for me.
@kaissoune
@kaissoune 2 жыл бұрын
❤️
@rctneil
@rctneil 2 жыл бұрын
Can anyone provide a link to the CQ polyfill?
@UnaKravets
@UnaKravets 2 жыл бұрын
github.com/GoogleChromeLabs/container-query-polyfill
@RickBeacham
@RickBeacham 2 жыл бұрын
I tried the new Container Queries in Canary with the experimental flag set to enabled but the demos are still not working like they did in the video... I have Canary Version 98.0.4750.0. Anyone know what may be the problem?
@UnaKravets
@UnaKravets 2 жыл бұрын
There was a (very recent) spec change to prepend with the size() function, i.e. @container size(min-width: ...) {} There's still discussion about if size() is required or both syntaxes (the function and the inital, similar to media queries) will be supported
@RickBeacham
@RickBeacham 2 жыл бұрын
@@UnaKravets Thanks for the quick follow up Una! I thought maybe I was losing my mind. Let me see if I can get them to work without the size() function.
@UnaKravets
@UnaKravets 2 жыл бұрын
@@RickBeacham This change has been reverted by the way(!) not in Canary yet
@safintheship
@safintheship 2 жыл бұрын
🤯
@leof4838
@leof4838 2 жыл бұрын
Music please!
@Pesthuf
@Pesthuf 2 жыл бұрын
I hope there's eventually going to be a polyfill for container queries that compiles at build time, ahead of time. Parsing and transforming CSS on the client side should never be necessary.
@FayettepressWebDesign
@FayettepressWebDesign 2 жыл бұрын
I don’t think that’s possible. Because of responsiveness happening at run-time, the only way to get the container element’s size is by querying the DOM with JS.
@Pesthuf
@Pesthuf 2 жыл бұрын
Of course, JS will be necessary. What I'd like is a solution that takes CSS that contains container queries and at build time from that generates css that contains classes like .my-element:where(.WidthHas500px) {...} and JS that contains Resize observers that then toggle these classes. That should improve performance and runtime bundle sizes over doing all of that, including parsing the CSS, at runtime. Of course it's a bad solution compared to having the browser implement it.
@persv988
@persv988 2 жыл бұрын
Why wasen't this implemented years ago?
@yogeshkad6928
@yogeshkad6928 2 жыл бұрын
Is container query ready to use
@UnaKravets
@UnaKravets 2 жыл бұрын
You can use it with the polyfill: github.com/GoogleChromeLabs/container-query-polyfill
@hobbyturystaSEO
@hobbyturystaSEO 2 жыл бұрын
What is the capacity of container queries to keep the container flexible? Possible the answer would work in other industries as well😎 (in light and dark mode 👁️‍🗨️)
@estevesazeiteiro
@estevesazeiteiro 2 жыл бұрын
C'mon when is it going live?! We have been waiting for ages... If you want adoption make it available!!
@crypcase150
@crypcase150 2 жыл бұрын
No win delta
@AlvarLagerlof
@AlvarLagerlof 2 жыл бұрын
Obvious in hindsight!
@user-ms8ei9le7x
@user-ms8ei9le7x 2 жыл бұрын
Ch®️me
@c3eb4
@c3eb4 2 жыл бұрын
i wish these videos would get straight to the point and not waste our precious dev time
Designcember is coming!
0:53
Chrome for Developers
Рет қаралды 11 М.
Generating your color palette in CSS | HTTP 203
28:02
Chrome for Developers
Рет қаралды 18 М.
Finger Heart - Fancy Refill (Inside Out Animation)
00:30
FASH
Рет қаралды 21 МЛН
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 22 МЛН
Inside Out 2: Who is the strongest? Joy vs Envy vs Anger #shorts #animation
00:22
Macro & micro layouts - Designing in the Browser
16:22
Chrome for Developers
Рет қаралды 24 М.
Learn how to use Media queries & Container queries
34:33
Kevin Powell
Рет қаралды 61 М.
Thinking on ways to solve TOASTS
14:38
Chrome for Developers
Рет қаралды 19 М.
Demystifying CSS Container Queries
1:27:44
Learn With Jason
Рет қаралды 2,9 М.
How to inspect CSS container queries #DevToolsTips
3:25
Chrome for Developers
Рет қаралды 14 М.
New CSS Units! Container Query Units explained
13:42
Kevin Powell
Рет қаралды 63 М.
10 modern layouts in 1 line of CSS
21:39
Chrome for Developers
Рет қаралды 1,1 МЛН
What’s new in DevTools: Chrome 124-126
7:30
Chrome for Developers
Рет қаралды 28 М.
Intrinsic CSS with Container Queries and Units with Miriam Suzanne
19:33
Container Queries are going to change how we make layouts
24:24
Kevin Powell
Рет қаралды 172 М.
Rate This Smartphone Cooler Set-up ⭐
0:10
Shakeuptech
Рет қаралды 4,9 МЛН
Это Xiaomi Su7 Max 🤯 #xiaomi #su7max
1:01
Tynalieff Shorts
Рет қаралды 2 МЛН
Looks very comfortable. #leddisplay #ledscreen #ledwall #eagerled
0:19
LED Screen Factory-EagerLED
Рет қаралды 4 МЛН