Container queries - Designing in the Browser

Поділитися
Вставка
  • Опубліковано 20 жов 2024

КОМЕНТАРІ • 49

  • @yahayaoyinkansola8258
    @yahayaoyinkansola8258 2 роки тому +35

    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 роки тому +13

    This is so cool. It makes web components so much more re-usable, dynamic, and natural.

  • @swampflux
    @swampflux 2 роки тому +9

    😗 There's a new Chrome Dev Video
    😯 Una's in it!
    😲 It's about container queries!!
    😵 container query based unit values!!!

  • @patricknelson
    @patricknelson Рік тому +2

    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.

  • @LuisVazquez-br5zf
    @LuisVazquez-br5zf 2 роки тому +3

    Truly next level. Thanks to all involved in this project.

  • @KennisKids
    @KennisKids 2 роки тому +9

    Can't wait to use it! So excited!

  • @Zarfin
    @Zarfin 2 роки тому +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 роки тому +1

    Amazing feature, makes developers life easy.

  • @Radical_Dreamer
    @Radical_Dreamer 2 роки тому

    You have become the queen of CSS!

  • @gotophotoarchive9131
    @gotophotoarchive9131 2 роки тому +1

    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

  • @petarkolev6928
    @petarkolev6928 2 роки тому +1

    Amazing! Thank you, Una 💖

  • @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?

  • @RodyDavis
    @RodyDavis 2 роки тому

    so excited about this feature!

  • @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 } }

  • @CarlosAraya25
    @CarlosAraya25 2 роки тому +1

    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

  • @normanejm
    @normanejm 2 роки тому

    Ok, What I understood... Is a CSS Component (UI).. right??

  • @alexr.4409
    @alexr.4409 2 роки тому +1

    This is really amazing!

  • @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 роки тому +1

      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.

  • @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 роки тому +1

      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 роки тому +1

      @@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 роки тому +1

      @@RickBeacham This change has been reverted by the way(!) not in Canary yet

  • @yogeshkad6928
    @yogeshkad6928 2 роки тому

    Is container query ready to use

    • @UnaKravets
      @UnaKravets 2 роки тому +1

      You can use it with the polyfill: github.com/GoogleChromeLabs/container-query-polyfill

  • @RATANAGARWALITINFORMER
    @RATANAGARWALITINFORMER 2 роки тому

    good info maam

  • @leopolon
    @leopolon 2 роки тому

    amazing!

  • @rctneil
    @rctneil 2 роки тому

    Can anyone provide a link to the CQ polyfill?

    • @UnaKravets
      @UnaKravets 2 роки тому

      github.com/GoogleChromeLabs/container-query-polyfill

  • @Pesthuf
    @Pesthuf 2 роки тому +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?

  • @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 👁️‍🗨️)

  • @safintheship
    @safintheship 2 роки тому

    🤯

  • @leof4838
    @leof4838 2 роки тому

    Music please!

  • @kaissoune
    @kaissoune 2 роки тому

    ❤️

  • @estevesazeiteiro
    @estevesazeiteiro 2 роки тому +1

    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 роки тому +1

    Obvious in hindsight!

  • @user-ms8ei9le7x
    @user-ms8ei9le7x 2 роки тому

    Ch®️me

  • @c3eb4
    @c3eb4 2 роки тому +2

    i wish these videos would get straight to the point and not waste our precious dev time

  • @adultbeginner695
    @adultbeginner695 2 роки тому +1

    Does it help with CLS?