2 replies [Last post]
Anonymous
Anonymous's picture
Guru
calgary,alberta
calgary,alberta

I have a simple page layout with 2 columns. This is a dynamic page fed by a database and either column could be the longest. How can I ensure both are of the same length.

The methods I've found on the web don't work well on this site. Appreciate your ideas. Note, the online version of this page is not connected to the database and has no content in the left and right columns. But you can get an idea of what's happening.

Thanks
David

http://www.netnoise.com.au/acpchn/news.php?id=3

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 4 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5344
Points: 2965

Making 2 columns the same length

It's very hard if not impossible to get two columns the same height in all browsers without knowing the height.

What you could try to do is give the appearance of the columns being the same height using a background image in a containing div.

<div class="container">
   <div class="left"> </div>
   <div class="right"></div>
</div>

.container{background-image: url(bgimage.jpg); background-repeat:repeat-y; width:100%;}
.left{float:left; width:50%;}
.right{float:right; width:50%;}

Anonymous
Anonymous's picture
Guru

Making 2 columns the same length

Thanks Tony

This seems to be working well. Not a perfect solution, but will make do.

David