html - 100% height of window with inner div scrolling -
i've been banging head against wall hard past couple of hours figure out way achieve layout i'd webapp. , head hurts.
basically need have full window layout (full width, full height, no scrolling - ever). 100% of width , height should covered using 2 different horizontal boxes (you can see them rows).
- the height of first box/row can variable (see header page)
- the 1 below should occupy what's left of space, without ever going further 100% of window, hence without ever showing scrollbar.
now what's bit more tricky within second box/row, want content displayed inner vertical scrolling. imagine second box/row contains list of items, in case of few items, bottom part of box/row should stop right after content. in case of many items, box/row should expand right until hits 100% of window height (which 100% of windows - height occupied first box/row). rest of content should visible through scrolling within second box/row.
am making sense?
regarding code, i'm not going copy/paste desastrous thing i've pulled because i'd rather start blank page.
this tried:
<html> <body> <div id="wrapper"> <div class="box">header</div> <div class="box">content <ul><li>...</li>(x1000)</ul></div> </div> </body> </html>
the reason why use "box" class because both boxes/rows should show same appearence in terms of backgrounds, margins, shadows, etc.
html, body { height: 100%; } #wrapper { position: absolute; height: 100%; width: 100%; left: 15px; right: 15px; top: 15px; bottom: 15px; }
for rest, i've tried (and failed far) manipulate .box
elements adding hazardously overflow: hidden; overflow-y: scroll; height: 100%; max-height: 100%; min-height: 100%;
etc.
thanks in advance help!
the problem because css has long been crappy auto-adjusting height available space.
the solution use wrapper that's set position: absolute
, tied top, left, right, , bottom edges of viewport. this, browser auto adjust height of element, , if have content div inside height: 100%
it'll fill space.
setting overflow-y: scroll
on wrapper allow content scroll if becomes long:
http://codepen.io/helion3/pen/jwbcx
site headers not variable in height. if you're defining site header using percentages, , if don't need support ie<8 can use percentages safely box-sizing: border-box
achieve same.
Comments
Post a Comment