Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6893151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:37:25+00:00 2026-05-27T06:37:25+00:00

Imagine this document: <!doctype html> <head> <title>Leak</title> </head> <body> <div id=container> <div id=main> <ul>

  • 0

Imagine this document:

<!doctype html>
<head>
  <title>Leak</title>
</head>
<body>
  <div id="container">
   <div id="main">
     <ul>
        <li>a</li>
        <li class="b">b</li>
        <li>a</li>
        <li class="b">b</li>
        <li>a</li>
     </ul>
   </div>
   <div id="footer">
     <div>Footer</div>
     <div style="height: 50px; width: 50px; background: red"/>
   </div>
  </div>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
</body>
</html>

Open it in chrome of firebug and you will see, that there is some kind of unexplained margin-top on the body element. It comes from the ul element, two levels deeper. I think this is kind of an eery behavior, but I am certain those wc3 guys who came up with that have had their good reasons.

But how, can I get to that in javascript? I need to set the #main div’s height to $(window).height() – $(‘#footer’).height(), so it that #footer is always at the bottom.

$('#main').height($(window).height() - $('#footer').height())

But this leaves a scrollbar, because of this space on top. Try removing the ul and everything is as expected. How can I account for this? This is for a plugin, so I cannot account for special markup, this should “just work”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:37:26+00:00Added an answer on May 27, 2026 at 6:37 am

    It works by setting “overflow: auto” to the stretched div, in this case #main. It is not a javascript solution, but is somewhat acceptable. I can let the user decide if this fix should be applied or he can take care of this elsewise.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine a fairly simple HTML document <!DOCTYPE HTML > <html> <body> <table> <tr> <td>
Imagine the HTML is like this: <a id=tour_gallery_link href=#>Click Me</a> <div id=tour_gallery> <a href=image1.png><img
Imagine this sample java class: class A { void addListener(Listener obj); void removeListener(Listener obj);
Imagine this simplified markup: <div id=header> <!-- Other things.... --> <div id=detail> </div> </div>
Imagine this small code $(document).ready(function() { $(#loadingDiv).load(sub/__window_div.php); }) It runs okay in Chrome, Firefox,
Imagine a xml file like this: <Document> <Tests> <Test> <Name>A</Name> <SubTest> <Test> <Name>B</Name> <Value>100</Value>
Imagine this directory structure: app/ __init__.py sub1/ __init__.py mod1.py sub2/ __init__.py mod2.py I'm coding
Imagine this function: void SoundManager::playSource(ALuint sourceID, float offset) { alSourceStop(sourceID); ALint iTotal = 0;
Imagine this case where I have an object that I need to check a
Imagine this subroutine: sub test(&&) { my $cr1 = shift; my $cr2 = shift;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.