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

  • SEARCH
  • Home
  • 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 7591713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:43:08+00:00 2026-05-30T20:43:08+00:00

I do not understand why my first div (#a) has a vertical scrollbar on

  • 0

I do not understand why my first div (#a) has a vertical scrollbar on this test:

*, html, body
{
    margin: 0;
    padding: 0;
}

html, body
{
    height: 100%;
    width: 100%;
    position: absolute;
    overflow: hidden;
}

#a
{
    height: 100%;
    width: 100%;
    display: block;
    position: relative;
    overflow: auto;
    background-color: indianred;
}
#b
{
    display: inline-block;
    position: relative;
    height: 90%;
    margin-top: 5%;
    margin-bottom: 5%;
    padding: 0;
    width: 100%;
    background-color: grey;
}

<div id="a">
    <div id="b">TEST</div>
</div>

Also see http://dabblet.com/gist/1933615.

As I see it, my inner div (#b) should take 100% (90% + 5% + 5%) and #a should not have any scrollbar. But it looks like #b is taking 101%.

What’s going on here?

  • 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-30T20:43:10+00:00Added an answer on May 30, 2026 at 8:43 pm

    I think that it has to do with pixel-rounding.

    Your rule is that #b occupies 90% of #a and has a margin on top of 5% and a margin on the bottom of another 5%. You’d think that would amount to 100%, right? 😉

    Ran two scenarios and checked in Firebug what Firefox was doing with those values.

    Scenario 1 - #a is 600px tall
    #b height = 540px
    #b margin-top = 30px
    #b margin-bottom = 30px
    540 + 30 + 30 = 600px === #a's height
    
    Scenario 2 - #a is 601px tall
    #b height = 541px (601 * .9 = 540.9 -> rounded up by browser = 541)
    #b margin-top = 31px (601 * .05 = 30.05 -> rounded up = 31)
    #b margin-bottom = 31px 
    541 + 31 + 31 = 603px > 601px -> #a's height
    

    BTW, if you’re looking at a resolution where all the proportions give you nice round numbers, there are no scrollbars.

    If you want to see this visually and have access to Firebug, check out the Layout (sub)tab (when the HTML tab is selected).
    (I’m sure you can analyse it in a similar fashion with Firebug Lite, Chrome dev tools and IE dev tools)

    Hope this helps.
    iso

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

Sidebar

Related Questions

I do not understand this error, do not generate error in JsonResult Test (),
I have a html structure like this.. <div id=divid> <ul id=ulid> <li style=margin-left: 8px>
i have this html code <div class=container id=container> <div class=post><h1>first title</h1>description here</div> <div class=post><h1>second
I have a recursive jQuery function that has something like this: parentItem.find('> div:first-child >
I simply do not understand why both works: this.timer.Tick += new EventHandler(timer_Tick); this.timer.Tick +=
This should really be allowed - I do not understand why it is not.
First,sorry to my bad english. I don't understand why my page not refresh when
I do not understand pointers. Where can I learn more about them?
I do not understand what environment a eval or exec statement executes in. You
I do not understand how to use enumeration types. I understand what they are,

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.