SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Inheriting Height?

    I'm trying to a simply layout with two columns and I want the height inherited so both of the columns run the same length and I don't get the ugly cut off of one of the colums but everything I try comes up short. (har har)

    Anyone able to shed some light?

    Thanks
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    http://www.ronincyberpunk.com/

  2. #2
    SitePoint Evangelist S7even's Avatar
    Join Date
    Jun 2002
    Posts
    481
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe that there must be more than one solution for this. here is what i use:

    in the head of your document add the following javascript:
    Code:
    <script language="JavaScript" type="text/javascript">
    <!--
    function equalheight(){
    h=document.getElementById('myDivOne').offsetHeight;
    document.getElementById('myDivTwo').style.height = h+'px';
    }
    onresize=equalheight;
    //-->
    </script>
    Then in your body tag:
    Code:
    <body onload="equalheight()">
    If you do this, myDivTwo will always have the same height as myDivOne. (as long as javascript support is turned on)
    edit:
    This works with modern browsers that support getElementById.
    (You can change it a bit to work with IE4 also, but i am not sure if you can make it work with NS4)
    Last edited by S7even; Feb 1, 2003 at 08:52.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •