Looking for a way to use variable heights on a CSS accordion - TechRepublic
Question
June 25, 2021 at 02:52 AM
stube8879

Looking for a way to use variable heights on a CSS accordion

by stube8879 . Updated 4 years, 11 months ago

Hey There!,
I’m Ajay owner of …………… and I’m working on a CSS accordion and I’m trying to find a way to make it animate, based on the height of the content. Currently, this only works if I specify the height. If I change the height to auto, the accordion still works, but it won’t animate because there is no height specified.

Here is the code I’m using:

.ac-container input:checked ~ article.ac-small {
height: 140px;
}
.ac-container input:checked ~ article.ac-medium {
height: 180px;
}
.ac-container input:checked ~ article.ac-large {
height: 230px;
}

Thank you.

Irrelevant company internet site removed as SPAM by moderator

All Comments