How do I set a div's height the same as another div ?

Discussion in 'CSS' started by Xabber, Jul 10, 2007.

  1. #1
    OK, here is the story :

    I got 2 div's ( content and column )

    Content is left and column is right. Now the problem is content is bigger in height, because there is more text in it. How do I give the column the same height without giving it a height in pixels, so it stretches with the text ?
     
    Xabber, Jul 10, 2007 IP
  2. Nima

    Nima Well-Known Member

    Messages:
    3,489
    Likes Received:
    243
    Best Answers:
    0
    Trophy Points:
    175
    #2
    Nima, Jul 10, 2007 IP
  3. ChasLaser

    ChasLaser Peon

    Messages:
    160
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The link to the actual JS doesn't work for me....:(
    All I see is a polar bear in a blizzard.
     
    ChasLaser, Jul 10, 2007 IP
  4. haruko764

    haruko764 Peon

    Messages:
    25
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    http://www.projectseven.com/tutorials/css/pvii_columns/index.htm

    That site will also teach you how to do what you're looking to do with javascript, and I believe that site works.
     
    haruko764, Jul 10, 2007 IP
  5. Nima

    Nima Well-Known Member

    Messages:
    3,489
    Likes Received:
    243
    Best Answers:
    0
    Trophy Points:
    175
    #5
    Are you talking about my article? Its working fine for me.
     
    Nima, Jul 10, 2007 IP
  6. Qal

    Qal Peon

    Messages:
    92
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Use the min-height property on the DIV thats shorter in height.

    Detailed explanation with example here.

    Hope it helps.
     
    Qal, Jul 10, 2007 IP
  7. SEV3N

    SEV3N Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I just use tables, it's the best solution (I don't understand the whole div layout problem, search engines have gone a long way since old days and almost every browser reads the tables in the same exact way). But anyway, like already stated, you may solve the problem with JavaScript since most CSS solutions may give the result on some browsers and on others may not. I know this is the CSS forum but here's a short JS example:
    document.getElementById('target').style.height = document.getElementById('source').style.height
    Code (markup):
    Hope it helps, good luck!
     
    SEV3N, Jul 11, 2007 IP
  8. Dan_A

    Dan_A Peon

    Messages:
    65
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Dan_A, Jul 11, 2007 IP
  9. Qal

    Qal Peon

    Messages:
    92
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Qal, Jul 13, 2007 IP
  10. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #10
    Using JS for that is lame. Most of the time faux columns will do.
     
    soulscratch, Jul 14, 2007 IP