I have a div element on my page with its height set to 100%. The height of the body is also set to 100%. The inner div has a background and all that and is different from t
Old question, but in my case i found using position:fixed
solved it for me.
My situation might have been a little different though. I had an overlayed semi transparent div
with a loading animation in it that I needed displayed while the page was loading. So using height:auto / 100%
or min-height: 100%
both filled the window but not the off-screen area. Using position:fixed
made this overlay scroll with the user, so it always covered the visible area and kept my preloading animation centred on the screen.
Set the height
to auto
and min-height
to 100%
. This should solve it for most browsers.
body {
position: relative;
height: auto;
min-height: 100% !important;
}
Just add these two line in your css id #some_div
display: block;
overflow: auto;
After that you will get what your are looking for !
use flex
.parent{
display: flex
}
.fit-parent{
display: flex;
flex-grow: 1
}
I'm not entirely sure that I've understood the question because this is a fairly straightforward answer, but here goes... :)
Have you tried setting the overflow property of the container to visible or auto?
#some_div {
height:100%;
background:black;
overflow: visible;
}
Adding that should push the black container to whatever size your dynamic container requires. I prefer visible to auto because auto seems to come with scroll bars...
Even you can do like this
display:block;
overflow:auto;
height: 100%;
This will include your each dynamic div as per the content. Suppose if you have a common div with class it will increase height of each dynamic div according to the content