Answer the question
In order to leave comments, you need to log in
How to make the block appear smoothly, and the content offset below, without setting a fixed height?
Good afternoon!
In css, for transition, there is this trick:
.nav {
height: 0;
opacity: 0;
transition: height .4s, opacity .3s;
}
.nav.active {
height: 500px;
opacity: 1;
}
Answer the question
In order to leave comments, you need to log in
Ideally, you should calculate the height of the block with a javascript and set it.
There is also a pure css solution, but it is not ideal. Here, instead of height, max-height is used with a deliberately large value, but not too much higher than the expected height.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question