I'm trying add transition effect to details element on opening and closing:
details { height: 1em; transition: height 2s; border: 1px solid; overflow: hidden; white-space: pre; } details[open] { height: 6em } <details> <summary>summary</summary>some hidden text </details> When it opens, it slowly expands, revealing the hidden text, but when it closes it hides the text instantly then slowly shrinks. I'd like it to hide the text by shrinking.
Is there a way achieve that in CSS only?
calc-size(auto). See this tweet: x.com/wesbos/status/1813207251311640895