I think it could be solved like:
.page {
background-color: #8f8;
min-height: 100%;
width: 80%;
}
.header {
background-color: #fdc;
overflow: hidden;
}
.content {
background-color: #ccf;
overflow-y: auto;
height: 100%;
width: 100%;
/*word-wrap: break-word;*/
}
Ok, what I have done:
- Page: you can put simply height to 200px if you really know the size of the heigh, but it makes more sense to me adding
min-height: 100%
to make the page fill all the space.
- Header: To allow the header resize when the content changes it is necesary setting its overflow as hidden. This will avoid for displaying any kind of scroll. Of course it must be a block element, like div or then you will have to add
display:block
.
- Content: Here put the height as 100% of the space, allow the visibility of the vertical scroll only when neded and break words only if the content you will display can make the horizontal scroll to appear.
Finally, to avoid the page going off the bottom put the header as part of the content div.
Ask me for more details.
UPDATE: here is the example where I have tested it.
UPDATE2
The best I have gotten is this:
.page {
background-color: #ccf;
max-height: 100%;
width: 80%;
overflow: hidden;
}
.header {
background-color: #fdc;
overflow: hidden;
}
.content{
overflow-y: auto;
height: 100%;
word-wrap: break-word;
}
The only problem it has is that the scroll thinks that what it is scrolling is all the "page" element not only the content, so you can not see the final arrow of the scroll.
I think this could be solved by using javascript, but with css I think there is no better solution.
Javascript possible solution:
$(window).resize(function() {
resizeContent();
});
$(document).load(function(){
resizeContent();
});
function resizeContent(){
$('.content').height($(".page").height()-$('.header').height());
}
The link with a final solution could be found here