One of the first things I needed to figure out is how to have the sidebar colour or pattern stretch to line up with the length of the content. I’ve found the best way to do this is to initially create a background image showing a segment of the width of your site like this:
(This image would repeat vertically, with the white bit as my content area and the coloured bit on the right as my sidebar)
Then set up your sidebar and content area within the y-axis repeating background div. This way, the content will stretch down and cause the background to repeat, forcing the sidebar colour to also extend.
See below for a quick code example:
First, the CSS to show the bg image and the content areas:
margin: 0 auto;
margin: 10px auto;
Now the div’s to organise your content
Sidebar content in here
Main area text
1 thought on “CSS : Stretch sidebar full height of the page”
Thank you! I tried some of the other hacks out there (the padding/margin overflow one, various positioning models, etc), but yours gave me exactly what I wanted while preserving my layout’s simplicity.