SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2005
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What's the height of my DIV?

    Ive done a bit of searching and can't find the info I'm looking for...

    I have a div, and I want to know what the height of it is. there is no set height style, and it's just a div so the default is 'auto'. a bunch of content is stuck in the div, so the height can vary. I need to manually size this div with javascript to fit the content.

    I think I'm missing something...

    document.getElementById('TEMP_CONTENT').?????

    piont me to the thread if it exists, thanks

    -p

  2. #2
    SitePoint Member
    Join Date
    May 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I ran acrossed this just recently where I wanted the right column of my three column page to have a background color different from left and center columns. The right column would only show a color background where actual content was displayed.

    Digging around the DOM in Netscape's Javascript debugger, I finally found the following to work...

    var vright=document.getElementById('col-right');
    var vfoot=document.getElementById('footer');
    var adjustment=121;

    vright.style.height=(vfoot.offsetTop-adjustment);

    This appears to work in IE6 but still having problems with Netscape/Mozilla browsers from honoring the change.

    b..

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2005
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so is 'offsetTop' is the height of your footer div after it's been loaded?


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
  •