I have a fixed div with 100% height, in which case a child div that is relatively positioned. The child-div contains text that can be changed, so it does not have a fixed height.
I want the child-div to scroll vertically if its contents overflow from the screen. I played with minimum and maximum height properties to achieve this, but this is not an ideal solution and does not always work.
EDIT: minimum and maximum heights were almost ignored. I calculated how many vertical areas of the textBox will occupy the minimum allowable height of the screen and set it as the height. The addition of a minimum and maximum height had nothing to do with this. The only problem with this solution is that the field is always around ~ 60%, so even if it does not need to be scrolled, it does. It works, but not perfect. If there is a way around this, it would be great.
This is what I still have:
<div class="content">
<div id="textbox"> some text
</div>
</div>
.content { position: fixed; height: 100%; top: 0px; right: 0px; }
#textBox {
position: relative;
top: 165px;
height: 61.5%;
overflow-y: auto;
}
Is there a better, safer way to do this?
sooks source
share