I did not like the solution height: 100%; position: fixed; height: 100%; position: fixed; because I wanted to leave the option open, having a background image that scrolls from the page later. (Although I did not think about this when writing the question.) I had a game and I found min-height: 100%; for work.
<html> <head> <style type="text/css"> body { padding: 0; margin: 0; } #container { width: 100%; min-height: 100%; position: relative; } #left, #right { width: 50%; height: 100%; position: absolute; z-index: -1; } #left { left: 0; background-color: navy; } #right { right: 0; background-color: maroon; } #content { width: 512px; height: 100%; margin: 0 auto; background-color: white; } </style> </head> <body> <div id="container"> <div id="left"></div> <div id="right"></div> <div id="content"> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> Hi<br /> </div> </div> </body> </html>
For some reason, it does not work in jsfiddle.net: http://jsfiddle.net/HktPN/ But this happens in my browser.
Jesse
source share