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 9154521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:26:26+00:00 2026-06-17T12:26:26+00:00

When I ask Firefox version 17.0.1 for document.body.getBoundingClientRect().top; on a simple site that has

  • 0

When I ask Firefox version 17.0.1 for document.body.getBoundingClientRect().top; on a simple site that has no styling at all, it returns the wrong value. I expect 8, which is the browser default, but it gives me 21.4. The .left offset however is correct.

In Chrome the offset is works fine and gives me 8 for both top and left.

I attached a Screenshot of the situation where you can see that the top shouldn’t be 22.4.Screenshot of the situation

Here’s the HTML

<html><head>
<title>Index</title>
<style type="text/css"></style></head>
<body>
    <div>
        <h1>Index</h1>
        <p>This is the index. The site contains in total 4 sites without
            any Javascript. They are linked using href links.</p>
        <p>The site looks like this:</p>
        <ul>
            <li>Index ->; a</li>
            <li>Index ->; b</li>
            <li>b ->; c</li>
            <li>c ->; b</li>
            <li>c ->; Index</li>
        </ul>
    </div>
    <a href="a.html">Go to A</a>
    <a href="b.html">Go to B</a>
</body></html>
  • 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-06-17T12:26:26+00:00Added an answer on June 17, 2026 at 12:26 pm

    Try giving your <html> a yellow background and your <body> a green background and see what the rendering looks like. I’ll bet the green rectangle is in fact 22px from the top of the viewport.

    The reason that happens is that the 8px top margin of the body is collapsing with the 22+px top margin of your <h1>, because those margins are adjacent. See http://www.w3.org/TR/CSS21/box.html#collapsing-margins

    Chrome has the same exact behavior in standards mode. But in quirks mode (which his what the above HTML snippet is in), it seems to do something weird where the <h1> still reports a 21px top margin but this margin does not collapse with that of the <body>.. though putting a top margin on the <div> does collapse it with the body. That’s quirks mode for you.

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

Sidebar

Related Questions

So i Have a pythons script that is outputting firefox bookmarks. (don't ask): The
Is it possible to ask a Firefox (version 15) user for more space (>
I'm creating a web site and I'm having trouble getting Firefox to ask me
...the reason I ask is that Safari has a bug in its implementation of
I ask a similar question here and Darin Dimitrov answer that we can't use
I have been tasked with developing a Firefox add-on that is capable of registering
In that page, the submenu if fine in firefox, but as usual, the nasty
I'm sorry to ask such a simple question with such a small amount of
I would like to know how can I ask X11 which windows has the
I am using jQuery.corner.js to put a top-rounded background behind the titles of all

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.