Here is what I want to achieve:

- The footer should remain at the bottom of the screen, even if the content does not fill the vertical viewport.
- Content columns have a border that should always be 100% of the content height. Since the number and width of the columns will vary from page to page, background images and fake column borders cannot be used.
- When all content is visible, there should be no scroll bars (example 1).
- The solution should be completely HTML / CSS, without JS.
- Minimum browser support should be IE9 + and the latest versions for desktop computers Firefox, Chrome, Safari, Opera; no fad mode.
- The width of the header / footer / content is always fixed (so there is no need to place the header and footer inside the content area). The height of the header and footer is also fixed.
I tried methods from columns of equal height of fluid width and this example with a footer attached , but could not satisfy all the requirements at the same time. Any advice is appreciated.
Edit: so far the farthest Ive got a table simulation that works correctly in webkit browsers, but not in IE9 and Opera. Look at the fiddle here .
HTML:
<div class="table outer"> <div class="row header"> <div class="cell">header</div> </div> <div class="row content"> <div class="cell"> <div class="table inner"> <div class="row"> <div class="cell">content 1</div> <div class="cell">content 2</div> <div class="cell">content 3</div> </div> </div> </div> </div> <div class="row footer"> <div class="cell">footer</div> </div> </div>
CSS:
html, body { height: 100%; } .table { display: table; min-height: 100%; height: 100%; } .table.outer { width: 500px; margin: 0 auto; } .row { display: table-row; } .cell { display: table-cell; } .header, .footer { height: 25px; background-color: #999; } .content { background-color: #eee; } .table.inner { width: 100%; min-height: 100%; height: 100%; } .table.inner .cell { width: 33%; border-right: 1px dashed #c00; }
source share