I have a traditional 3-column layout: nav, content and sidebar.
The content and sidebar both have a background-color that needs to cover 100% of the visible height at all times, regardless of how much content is in it. In other words, the background should remain there when scrolling down, or resizing the page.
Please see this jsfiddle for reference: http://jsfiddle.net/thv20/acJVw/1/
The problem is that when you scroll down or resize, the background cuts off. How can I fix this? I’ve seen suggestions of using min-height: 100%, but I can’t get that to work.
Remove “height: 100%” off the body tag as this is what is breaking your layout.
Instead, use
position: absoluteon the side bar and position ittop:0bottom: 0as this will make its height “100%”. Also setright: 0to position it on the right hand side of the container div (this is safe to do as you have set widths).CSS
JSFiddle: http://jsfiddle.net/acJVw/6/