2

I've taken code from my site and simplified it and put in on jsfiddle to describe my problem a little better.

http://jsfiddle.net/5vMHC/3/


So what I'm tryin to do is have a border line seperating the left column from the right column, however I want the line to stretch to the height of the column with the most content. The way I have it setup now, I put border-left on the right column content, so if the content is smaller than the content in the left column, it only stretches to the height of the right column.

How can I make it stretch to length of the longest content? Would I have to make both columns equal to the longest? How do I go about doing this? Is my html structure okay? Thanks!

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
user1143767
  • 1,461
  • 2
  • 13
  • 13

3 Answers3

3

The easiest way to do this is to add a filler type element with the border and position it absolutely:

CSS

.filler {
    border-right:1px solid #CDE;
    width: 209px;                   /* width of #sub_page_left_column */
    position: absolute;
    bottom: 0;
    top: 0;
}

/* add position relative so filler is positioned in respect to this div */
#content {
    ....
    position: relative;           
    ....
}

HTML

<div id="content">
    <!-- add the new filler element -->
    <div class="filler"></div>  
    <div id="sub_page_left_column">...</div>
    <div id="sub_page_right_column">...</div>
</div>        

Right longer: http://jsfiddle.net/5vMHC/5/

Left longer: http://jsfiddle.net/5vMHC/6/

My Head Hurts
  • 37,315
  • 16
  • 75
  • 117
0

hope this links can help you!

http://positioniseverything.net/articles/onetruelayout/equalheight

How to have two columns that are the same height in HTML?

Setting a div's height in HTML with CSS

good luck!

Community
  • 1
  • 1
MCSI
  • 2,818
  • 26
  • 35
0

There is no simple included way to achieve your goal.

When you read this article, then you will learn 4 possible ways to do it and you can then decide what is the best way for your project.

Sven Bieder
  • 5,515
  • 2
  • 21
  • 27