3

I'm currently working on a website where I have a short description and a toggle button which will expand that description into a long description. It looks something like this: https://codesandbox.io/s/nervous-hugle-q27lz?file=/src/App.js

I'd like to make the transition when the toggle button is clicked look smoother. I've read a few posts which suggest a div height must be set for this to work, but the height is currently auto because the content is dynamic (from a headless CMS).

Does anyone know how I can do this? I'd be very grateful for the help, thanks.

David Fox
  • 55
  • 9
  • Does this answer your question? [How can I transition height: 0; to height: auto; using CSS?](https://stackoverflow.com/questions/3508605/how-can-i-transition-height-0-to-height-auto-using-css) – Ramesh Reddy Sep 11 '21 at 09:43
  • While you cannot transition to/between auto heights you can transition between max-heights and this might help in this case. – A Haworth Sep 11 '21 at 09:52

0 Answers0