How do I create a div that does not resize when the internal content changes?


I'm trying to create a media feed, which may contain text, images, videos, etc. Some of these posts may be explicit, so I want to hide the content of the post with a warning, which the user would have to click to see the post.

I've successfully done this, except the div containing he post changes size when the warning is clicked. How can I change this so that the size of the div remains constant when the inner content changes?

You can use below code which does not resize div. It will allow to scroll content within fixed size.


<div class="text-center" style="height: 300px; overflow-y: auto;">
//contents inside div