View Full Version : Div stretching

08-05-2010, 04:28 AM
Hello, I am new to the forums. I am in the making of a website, and am using divs.

I know that div layout boxes stretch depending on the content placed in them, but I have two content boxes that need to be the same length.

I'd like to know how I can make both boxes at the same height, constantly, not depending on if the have the same amount of content.

My site is http://ghost.sporatic.net/ if you would like to look and see the two low content boxes.

08-05-2010, 05:59 AM
Try specifying them with the same width in css:
div1{width: 50%;}
div2{width: 50%;}
div1{width: 100px;}
div2{width: 100px;}

As for height, I think there's a way to do that, but you shouldn't just specify an exact height, especially if your height is going to change (if you specify 100px for your height and the content goes past that, it won't look right). Sorry, I'm not that good at styling, but know one else was answering so I thought I'd try my best to.

08-05-2010, 06:07 AM

You can make a background image that stretches for a containing div.


<div id="container">
<div class="one">1</div>
<div class="two">2</div>


#container {
background:url(vert-columns.jpg) repeat-y;

Edit: There are also jQuery plugins for this if you'd just like to set a min-height on your left div rather than using the faux-columns solution.