Skip navigation
CSS sidebar tricks 🤌
0:00 / 0:26

CSS sidebar tricks 🤌

jhey ʕ•ᴥ•ʔ

@jh3yy149K followers

Visit on X
2,641 likesDownloadOriginal post

117,836 views

CSS sidebar tricks 🤌 transition expanded menu items to "auto" height using grid li > div[inert] { grid-template-rows: 0fr; } li > div { grid-template-rows: 1fr; transition: grid-template-rows .3s; }

10 Comments

Comments from the original post on X (Twitter)

  • Pavel Ivanov's profile picture

    @ivanovpavel

    yeah :) I use something close to this in react-scan! The old min/max-height hacks are no more!

    3 likes

  • jhey ▲🐻🎈's profile picture

    @jh3yy

    yeah - solid solution until we get decent support for interpolate-size 🙏

    5 likes

  • MGSimard's profile picture

    @MGSimard

    Oh man inert is a thing? yoink

    3 likes

  • jhey ▲🐻🎈's profile picture

    @jh3yy

    yep!🤙 so good for things where you need to hide from AT etc. but don't really want to use display none

    1 like

  • Arthur's profile picture

    @arthuryuzbashew

    Bro is working on Vercel itself...

    1 like

  • jhey ▲🐻🎈's profile picture

    @jh3yy

    🫡

  • Diogo's profile picture

    @dioScar90

    Didn't know about this inert attribute. Cool.

    1 like

  • jhey ▲🐻🎈's profile picture

    @jh3yy

    super useful 💯 being able to hide things without juggling display none makes transitions so much easier 🙌

    1 like

  • Roo and Sashas Happy Days's profile picture

    @RooAndSasha

    how does inert effect accessibility when using keyboard with these buttons

    1 like

  • Typzo's profile picture

    @pizadevourerman

    Probably one of the best tricks grid has to offer!