rulururu

post How to stretch sidebar(div) vertically (whole height of site) ?

June 9th, 2010

Filed under: CSS, Tip — Alex Bylim @ 5:22 pm

Hey dudes, I know there are a lot of different approaches make two-columns layout, and to make sidebar stretch vertically. But always there is one problem: side bar should fill vertical side area 1) when content longer then sidebar 2) when content shorter then sidebar. So here is how to solve this with CSS:

/* this will allow sidebar stretch vertically in right way */
html, body {
	min-height:100%;
	position: absolute; 
        width:100%;
}
 
/* stretching our sidebar */
#sidebar{
 width: 300px;
 height: auto;
 min-height:100%;
 position:absolute;
 background-color: #555;
}

To make content block is not to hard and you need is to set margin-left the same width as sidebar width

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

ruldrurd
Powered by WordPress, Web Design by Laurentiu Piron
Entries (RSS) and Comments (RSS)