I am attempting to create a full-screen website with 100% height and no scrollbar. I have a div that takes up 90% of the page height and I want to dynamically add elements inside it. However, when there are too many elements inside this div, they expand the parent's height. This poses a problem because the "overscroll:hidden" property on the body causes the bottom half of the page to be out of view. I have created an example to demonstrate this issue:
If you remove the class="textBox"
elements, you can see how it should look. I have tried adding the overflow:scroll
property to the parent div, but it does not solve the problem, nor does max-height:100%
.
HTML
<div id="wrapper">
<div id="left">
<div id="something">valami</div>
</div>
<div id="right">
<div id="parent">
<ul id="container">
<li>
<ul class="group">
<li class="textBox">
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
</li>
<li class="textBox">
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
</li>
<li class="textBox">
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
lorem ipsum<br />
</li>
</ul>
</li>
</ul>
<div id="bottomContainer">
</div>
</div>
</div>
CSS
body, html {
height: 100%;
margin: 0;
overflow: hidden;
}
#wrapper {
height: 100%;
width: 100%;
display: table;
}
#left, #right {
display: table-cell;
width: 50%;
height: 100%;
background-color: green;
}
#left {
background-color: red;
}
#parent {
padding: 50px 0 150px;
height: 100%;
}
#container {
border: 1px dashed black;
height: 100%;
max-height: 90%;
overflow: scroll;
}
#container li {
max-height: inherit;
}
#bottomContainer {
height: 50px;
border: 1px dashed black;
}
.group {
padding: 10px;
}
.textBox {
border: 1px dashed black;
margin: 10px 0;
}
ul {
list-style: none;
padding: 0;
}