We Can Finally Animate height: auto; in CSS!

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

КОМЕНТАРІ • 130

  • @nekomew
    @nekomew Місяць тому +93

    Finally! No more max-height or single column grids to get accordion to work.

    • @drprdcts
      @drprdcts Місяць тому +29

      Now wait 2 years before this reaches stable browsers. Another 3 years before it reaches 98% users compatibility. Another 5 years before you can use it in a serious company because nobody wants to use a broken website when you're making money

    • @dopetag
      @dopetag Місяць тому

      I made it work with several columns and max-height

    • @_PatrickO
      @_PatrickO Місяць тому +1

      @@drprdcts Not how it works. They would be using a polyfill to provide the missing javascript functions in unsupported browsers. They provide manual javascript implementations that will be slower, but only provide the missing functionality when the browser version does not natively support the function. Odds are what will happen is that their existing code already uses polyfills based on early version of these functions from years ago. When people have a browser with the function built in, the page will use less cpu power and drain your device battery less if it has one.

    • @vaggelis_best
      @vaggelis_best Місяць тому

      ​@@drprdctsexactly. If those issues were adressed a bit more quickly, we wouldn't have to wait until retirement to usd them! Why can't they just implement new features quicklier? And even then, almost no one updates their browser. So annoying.

    • @MaxWeir
      @MaxWeir Місяць тому

      This can also be done using CSS Grid

  • @iamfastre
    @iamfastre Місяць тому +63

    wow, new cool css features! can’t wait to use them in 2034

  • @vanechka222
    @vanechka222 Місяць тому +75

    Nice, now everyone who downloads Canary and enables the experimental flag will be able to see my animations

    • @dopetag
      @dopetag Місяць тому +14

      yes, the title is such a clickbait

    • @helloworlditsworld
      @helloworlditsworld Місяць тому

      😂

    • @adeptiworks
      @adeptiworks Місяць тому

      @@dopetag it's not really that much of a bait, since browsers today update regularly and we probably get this supported in 90%+ till the end of the year

  • @omariyassinee
    @omariyassinee Місяць тому +84

    It's like CSS is slowly becoming a programming language: 3

    • @MrMate91
      @MrMate91 Місяць тому +4

      the variable definition in css is already outta control, since minifier use this to hide some properties in var, then other var combines other var and so on ...

    • @tochimclaren
      @tochimclaren Місяць тому +1

      which is fine in my opinion.

    • @Xeratas
      @Xeratas Місяць тому +5

      that would actually be an improvement, because we had rules and syntax for best practice.

    • @k16e
      @k16e Місяць тому

      It was always a programming language and like all pl it continues to improve...this very much like a few others that have come out is just sheer beauty

    • @NINJ3D1TS
      @NINJ3D1TS Місяць тому

      Isn’t that what it literally is?

  • @herveelec
    @herveelec Місяць тому +1

    good job , in html use and

  • @denvernaicker8250
    @denvernaicker8250 Місяць тому +12

    @3:35 asking for 20+ years

  • @nustaniel
    @nustaniel Місяць тому +14

    Knowing Firefox, they'll take over 5 years to add something like calc-size(). I hate how slow they are at adding features that has been in the other browsers for over 2 years.

    • @3pcgi959
      @3pcgi959 Місяць тому

      It works already in all browser

    • @nustaniel
      @nustaniel Місяць тому

      @@3pcgi959 No it doesn't. Go ahead and check caniuse, and notice if you search calc-size, it wrongly looks up aspect-ratio. MDN has no documentation on calc-size either. At least Firefox finally added CSS property in the recent update.

  • @lucasfranco1758
    @lucasfranco1758 Місяць тому +1

    I was just trying to do this a couples of hours ago, im so glad we can finally do this :)

  • @SebastianZartner
    @SebastianZartner Місяць тому +2

    The support info on @starting-style is a little bit outdated. Firefox has support for it starting in version 129. Unfortunately, it does not yet support transitions to and from `display: none;` which is probably one of the main use cases for it. Caniuse is now also updated to reflect that.

  • @dubemdesign
    @dubemdesign Місяць тому +1

    Wow, now I need to update all my accordian & FAQ components. Thanks

  • @popopp2297
    @popopp2297 Місяць тому

    It's funny how when I first started watching your videos I was listening and not fully understanding what you were teaching.. Now it all makes sense. Thank you for your amazing videos!

  • @Xeratas
    @Xeratas Місяць тому

    There are some realy good solutions to this already using grid, but having this out of the box is amazing.

  • @kueifengtung
    @kueifengtung Місяць тому

    Amazing video ty Kyle. You should make a video announcement when these features go online with a callback to this video

  • @Malvitima0
    @Malvitima0 Місяць тому

    This are great new features and will turn the styling animation process more ease to do.

  • @teodordimitrov7062
    @teodordimitrov7062 Місяць тому +1

    This is really amazing . Thank you for the great video.

  • @somewonderfulguy
    @somewonderfulguy Місяць тому

    I am FE dev since 2011. What I use for animating height this days is react-spring. But regarding CSS auto height I can say only this: at last!

  • @keviincosmos
    @keviincosmos Місяць тому

    CSS grid is a great way, and fully supported.

  • @PicSta
    @PicSta Місяць тому

    I would move things like calc-size() into an @supports rule. This gives you the chance to design both states independently (if you want to be very specific). Well explained video and I can't await browser support will be better.

  • @YanasChanell
    @YanasChanell Місяць тому

    Great news! Im not sure which feature I like more

  • @monoq_
    @monoq_ Місяць тому +2

    Thank you Kyle.

  • @itskittyme
    @itskittyme Місяць тому +2

    CSS guys: Let's fix the auto animations so people can do "height: auto" and it just works
    Also CSS guys: Oh wait, let's keep them on their toes and require them to use a function for that like "height: calc-size(auto)"
    ...

  • @talkdatrue
    @talkdatrue Місяць тому +3

    Now they need find a way to update browsers remotely somehow so we can actually use these and not wait 5 years each time

  • @alexeyshaykov
    @alexeyshaykov Місяць тому +1

    OMG!!!! Been waiting for this for 10 years while I've been working! Thanks Kyle!

  • @axMf3qTI
    @axMf3qTI Місяць тому

    The first example can be solved with grid and toggle between grid-template-rows; 0fr and 1fr.

  • @ezwtwrziehag1736
    @ezwtwrziehag1736 Місяць тому +3

    hey how you move ur head like that all the time 😅

  • @TeslaIL
    @TeslaIL Місяць тому +11

    What will Tailwind do? 🤣

    • @TfgTgy
      @TfgTgy Місяць тому +1

      😂😂😂

    • @YuiuIooo-oz5tm
      @YuiuIooo-oz5tm Місяць тому +6

      They need to pray hard 🤣

  • @BlurryBit
    @BlurryBit Місяць тому

    Everytime I hear about a new css feature, it excites me and makes me sad at the same time. Something as simple as text-wrap does not work in relatively new mobile browsers e.g. ios 14-15 safari.
    I really wish to see a day where every browser vendor will update on the same day. Probably dreaming.

  • @ahassan5
    @ahassan5 Місяць тому

    I've been waiting for this feature since I was in high school.

  • @silentshadow867
    @silentshadow867 Місяць тому

    You can also utilize grid to do this.

  • @Yimimura
    @Yimimura Місяць тому +2

    If only our UX Designers were ok to have progressive enhancement and not about "we need all this on all browsers, especially Safari"...

  • @LutherDePapier
    @LutherDePapier 10 днів тому

    It's interesting, but since doing this JavaScript with Framer Motion works on browsers that don't support these features yet (which is most browsers), it's better to strict to the JavaScript route at this time.

  • @flummox3d
    @flummox3d Місяць тому +1

    Animating from display-none to display-block has been my archenemy for years. Well, not anymore!

  • @WithDebugger
    @WithDebugger Місяць тому

    I just want the nesting of CSS to be as similar as the existing less and sass.

  • @terrencemurray-7628
    @terrencemurray-7628 Місяць тому

    I was literally plagued by this issue just last week, haha. It took some doing to get working correctly for some reason.

  • @aqibmalik6313
    @aqibmalik6313 Місяць тому +1

    Kyle is Love ❤❤❤❤

  • @Sabrecho
    @Sabrecho Місяць тому

    Thank you Kyle. 🤜🤛

  • @themks8452
    @themks8452 Місяць тому +7

    i didn't expect for this feature. now no need to write ugly js for it anymore

  • @jivkojelev3744
    @jivkojelev3744 Місяць тому

    I found solution with grid.
    In styled component something like this:
    const CollapsibleContent = styled.div`
    width: 100%;
    display: grid;
    grid-template-rows: ${({ $isOpen }) => ($isOpen ? 1 : 0)}fr;
    transition: 0.8s ease-in-out;
    `;

  • @potaetoupotautoe7939
    @potaetoupotautoe7939 Місяць тому

    love your videos.
    you should fix your posture bcuz its going to cause you pain later on.
    please take care.

  • @kamil8263
    @kamil8263 Місяць тому

    my hero

  • @jenstornell
    @jenstornell Місяць тому

    To get rid of the js, you could use the checkbox hack.

  • @k16e
    @k16e Місяць тому

    This @starting-style feature, can it work with "intersection observer", waiting for the browser/user to be on the page/section before animating? Just like gsap does?

  • @MonsieurSansHonte
    @MonsieurSansHonte Місяць тому

    Ooh, that’s nice.

  • @strangertongues
    @strangertongues Місяць тому

    You forgot the card for forwards at 6:10 :)

  • @TheMetalMag
    @TheMetalMag Місяць тому

    that's great! thank you

  • @Abdallah_Ismail
    @Abdallah_Ismail Місяць тому

    4:47 I wish it was a black box

  • @DennisTheZZZ
    @DennisTheZZZ Місяць тому

    Me to Javascript: „I don‘t want to play with you anymore.“

  • @bojidaryovchev9995
    @bojidaryovchev9995 Місяць тому

    u can do that easily without this new trick.. each element has scrollHeight which is the height of its content and it works even if the element itself has height 0, so what you can do is u can run a script to just take the element scrollHeight and set it as a CSS variable on the element style (this is done just once) and then you animate to height var(--content-height), this is a super easy solution and should work everywhere, no need to wait for global support

  • @navaneethbonthu1247
    @navaneethbonthu1247 Місяць тому

    Good info it's very useful

  • @HeyNoah
    @HeyNoah Місяць тому

    So sick!

  • @erin1569
    @erin1569 Місяць тому

    Omg this was such a headache on one of my projects

  • @HartleySan
    @HartleySan Місяць тому

    Man! How long until calc-size(auto) is standard in all heavily used browsers?

  • @sagarsivan2841
    @sagarsivan2841 Місяць тому

    For height animation Give
    max-height: 0;
    And in show class max-height: 1000px;
    This will work.

  • @Code_Cosmoss
    @Code_Cosmoss Місяць тому

    How do i get the new update? Should I update my vs code and browser?

  • @premkrrajbhar
    @premkrrajbhar Місяць тому

    img {
    Height : auto;
    Width : value ( % )
    }
    If you set this then the image will become so responsive at the end.

  • @moikanos11
    @moikanos11 Місяць тому

    how are you releasing this on the same day i spent 8 hours trying to do this exact same thing in a simple way?

  • @stepanzavadil
    @stepanzavadil Місяць тому +1

    3m topic in 13m video
    This channel has its best years long behind it

  • @AbstruseJoker
    @AbstruseJoker Місяць тому

    CSS is so crazy

  • @MaxPicAxe
    @MaxPicAxe Місяць тому

    I just want to animate background: linear-gradient

  • @nagymihaly8072
    @nagymihaly8072 Місяць тому

    Very useful thanks

  • @geoffyuendesign
    @geoffyuendesign Місяць тому +3

    Why don't browser makers implement animating height to auto instead of creating a whole new rule attribute of calc-size: auto? Wouldn't that logically make more sense rather than everyone having to remember this new attribute?

    • @Austneal
      @Austneal Місяць тому +5

      Because changing how something works is generally a no-no in web dev. It's why so much old JS is janky and they have to keep adding on. If you change how existing functionality works, you end up breaking things that rely on it working the way it currently does.

  • @matthieudantes4129
    @matthieudantes4129 Місяць тому

    thanks

  • @doctorDevZ
    @doctorDevZ 23 дні тому

    Nice

  • @phead2137
    @phead2137 Місяць тому +6

    We really can’t, since it’s only available on canary chrome behind a flag.

  • @daliovic24
    @daliovic24 Місяць тому

    CSS is getting fixed 🎉

  • @GGGGGGGGGG96
    @GGGGGGGGGG96 Місяць тому

    nice 😀

  • @realbigsquid
    @realbigsquid Місяць тому

    But how to do with tailwind?

  • @Crix-X982
    @Crix-X982 Місяць тому

    Bro can we also use fit-content for height or calc-size is better???

  • @cs5chesterYT
    @cs5chesterYT Місяць тому

    Finally!!

  • @windmacher
    @windmacher Місяць тому

    yay!

  • @CalmConcept
    @CalmConcept Місяць тому

    It’s about time😂

  • @gavquinny
    @gavquinny Місяць тому

    Chrome is showing `invalid property value` for `height: calc-size(auto);` - version 126.0.6478.127 - am I doing something wrong? PS. Love your vids, so keep them coming :)

    • @WebDevSimplified
      @WebDevSimplified  Місяць тому +1

      You must be using the canary version of Chrome with experimental web features flag enabled

    • @gavquinny
      @gavquinny Місяць тому

      Ah, I think I need to turn on the experimental features within Chrome, or download Chrome Beda ~ I will try these now 👍

  • @davidkonevky7372
    @davidkonevky7372 Місяць тому

    WAR IS OVERRR!

  • @eldarsadykov
    @eldarsadykov Місяць тому

    0:30 Bad dev simplified?)

  • @jasonl122
    @jasonl122 19 днів тому

    The disappointment when there's not even a caniuse page. 😢

  • @xircle
    @xircle Місяць тому

    Works on Android 🎉

  • @DeepTitanic
    @DeepTitanic Місяць тому

    I got excited and used @starting-style as a progressive enhancement it went live and caused a memory leak in production and it took 10 devs to track it down. Be careful!

  • @multiwebinc
    @multiwebinc Місяць тому

    calc-size()? Why not just allow animation to/from auto instead of introducing a function?

    • @DillionMegida
      @DillionMegida Місяць тому

      Could be because of “backward compatibility”…there are probably people who used “auto” and didn’t want any animation-but if you just make animation the default, those people would get results they didn’t expect and as you would imagine, this can ruin a lot of websites
      introducing a new function means “only those that are interested, can turn it on, instead of turning it on for everyone using html”

  • @unique_md5
    @unique_md5 Місяць тому

    when coming to tailwind ?????

  • @maheshypillai
    @maheshypillai Місяць тому

    Unni browth

  • @Pfoffie
    @Pfoffie Місяць тому

    Very disappointed (and I feel a bit baited) that calc-size doesn’t really work yet

  • @theneverwas2835
    @theneverwas2835 Місяць тому

    How is a document like this presented to a text to speech user? Is it accessible? If not it seems like you should not use it.

  • @liwen7252
    @liwen7252 5 днів тому

    this is called progressive enhancement

  • @salad5674
    @salad5674 Місяць тому

    I having trouble with stranparent sticky header of table can you share something my lord

  • @firstlast493
    @firstlast493 Місяць тому

    Who are those people who use older browsers? 🤔

  • @Gatuxos123
    @Gatuxos123 Місяць тому

    What is all of that head shaking damn...

  • @canarymultimedia
    @canarymultimedia Місяць тому

    Why do you shake your head so strongly? Is this some kind of condition?

  • @shawnrosales12
    @shawnrosales12 Місяць тому

    Let's goooo

  • @Alex-BSD
    @Alex-BSD 26 днів тому

    Anyone still watching this in 2041?

  • @IvanSollima
    @IvanSollima Місяць тому +2

    Slight flavours of click bait. Compatibility should have been first sentence.

  • @AchwaqKhalid
    @AchwaqKhalid Місяць тому

    Goddamit dude use a *BIGGER FONT* 🔭

  • @nagualdesign
    @nagualdesign Місяць тому

    I get a sore neck from watching your head constantly wobbling from side to side. It's very distracting.

  • @hjetwd
    @hjetwd Місяць тому

    ok, another piece of crap that will be introduced in 100 years... we continue to use grid-template-rows: 0fr; + transition: grid-template-rows; + :hover {grid-template-rows: 1fr;}

  • @Efecretion
    @Efecretion Місяць тому

    Please people. Don't use animations. Ever. Anywhere. The UI will *always* be better without them.

  • @CrAzZyKiLleR01
    @CrAzZyKiLleR01 Місяць тому

    Videos getting worse IMO

  • @androrifain
    @androrifain 22 дні тому

    pourquoi tu secoue autant la tete quand tu parle ?

  • @SridTech
    @SridTech Місяць тому

    I am first Kyle

  • @hldfgjsjbd
    @hldfgjsjbd Місяць тому

    Do you have some medical condition?

  • @valikonen
    @valikonen Місяць тому

    Make it shorter! I will not stay 12minutes in the morning for this....see you on the next try, bye!

  • @tharindudasun7233
    @tharindudasun7233 Місяць тому

    Nice