I am trying to build this very simple (visually speaking) layout using HTML/CSS that you can see in the wire frame below:
/------------------------------------------\
| |
| header div |
| |
|------------------------------------------|
| |S |
| main div |C |
| |R |
| |O |
| |L |
| |L |
| | |
| |B |
| |A |
| |R |
\------------------------------------------/
It has a 200 pixel high “header” DIV that fills 100% of the view port horizontally and then below it is the “main” DIV that fills 100% of the remaining empty space (horizontally and vertically) with scrolling set to “auto” to account for any overflowing content.
The hard part is getting the “main” DIV to fill this remaining space without using JavaScript. when I cant really use percentage heights and still have the scroll bar be entirely visible.
I guess at this point I am willing to use tables for this basic part of the layout if that becomes the only non-JS option. Semantics wont be an issue.
So how can I go about doing this? An example would be great too!
Just tried figuring something out and the closest pure-css solution I can find is to use percentages for both heights and setting the header’s min-height to 200px. However when the viewport isn’t as big as expected the bottom div goes slightly beyond the fold.
A good solution here would be to go through your statistics and figure our what the most used screen height for your visitors use is, around 800px probably. Then set something like this
This would ensure that your design works perfectly in most cases.
Although why somebody would want to keep everything above the fold in this day and age eludes me to be honest. We’ve all gotten pretty well used to scrolling and with modern widescreen designs scrolling is rather ubiquitous