I have the following html:
<div class="slider">
<div>
<img>
</div>
<div>
<img>
</div>
<div>
<img>
</div>
</div>
The inner elements all contain an element and some other stuff but for sake of simplicitty I left that out. In my Javascript these elements get hidden with display: none while always only one is displayed as block. As you might guessed at this point it's suppossed to be a slider.
My problem is at the time, that in the small moment the display changes, all elements that follow will jump to the top for a split second.
My question is: How can give the whole element a height so that it doesn't collapse when in the moment it's basically empty?
All my images are 16:9, so I gave my element the width: 100% and my height: 56.25%. These would be the correct and functioning values, but it doesn't fixes my problem.
CSS:
.slider {
width: 100%;
height: 56.25%;
}
.slider img {
height: 100%;
width: 100%;
}