Using CSS transitions on auto dimensions | CSS Tricks

A selection of possible workarounds for animating CSS values with auto keywords (e.g. height, width, etc.). Not a huge fan of the Flexbox option, but the max-height trick is a very useful one to remember (it works with min-height too, and you can use them in conjunction for some fun effects).

transition: max-height 500ms ease-out;

Explore Other Notes

Newer

TypeScript string literal arrays

A useful trick when working with tokenised values is that you can generate an "immutable tuple" within a "const context" (computer science gibberish overload 😂) and reference that. So if you have …

  • <!DOCTYPE html> <html> <head> <title></title> </head> <body> <p>A selection of possible workarounds for animating CSS values with auto keywords (e.g. height, width, etc.). Not a huge fan of the Flexbox option, but the max-height trick is a very useful one to …</p> </body> </html>
  • Murray Adcock.
Journal permalink