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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:26:11+00:00 2026-05-23T01:26:11+00:00

I have some pretty basic HTML/CSS that isn’t working as I expect. Basically I

  • 0

I have some pretty basic HTML/CSS that isn’t working as I expect. Basically I have my body setup to be 400px wide. I then have two divs inside of the body with explicit widths of 300px and 100px. Additionally, both of these divs are set to display: inline-block. For some reason, the 100px div breaks out of the body’s content area and appears below it. I don’t know why this is happening. If I set the width from 100px to 96px, it works. However, if I set it to 97px, 98px, 99px, or back to 100px, it doesn’t work. I find this behavior very odd. Can someone explain what is going wrong?

Note that I am testing this on Chrome (Beta Channel). Code is below.

The CSS:

body {
    margin: 4px;
    width: 400px;
    height: 250px;
    border: 1px solid black;
}

.list-container {
    display: inline-block;
    width: 300px;
    height: 100%;
    background-color: red;
}

.button-container {
    display: inline-block;
    width: 100px;
    height: 100%;
    background-color: blue;
}

The HTML:

<body>

<div class="list-container">
</div>

<div class="button-container">
</div>

</body>
  • 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-23T01:26:12+00:00Added an answer on May 23, 2026 at 1:26 am

    It’s because of the way white-space collapses in html.

    If you remove the line-breaks from between the two div elements, everything’s fine:

    <div class="list-container">
    </div><div class="button-container">
    </div>
    

    JS Fiddle demo.

    You could, also, just comment-out the between divs:

    <div class="list-container">
    </div><!--
    
    --><div class="button-container">
    </div>
    

    JS Fiddle demo.

    Or even set the font-size to zero for the body element (but you’ll have to redefine it for the child elements, obviously:

    body {
        margin: 4px;
        width: 400px;
        height: 250px;
        border: 1px solid black;
        padding: 0;
        font-size: 0;
    }
    

    JS Fiddle demo.

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

Sidebar

Related Questions

I have an application that generates some pretty basic reports. I have installed the
this should be a pretty basic question. I would like to have some html
I have setup some tabbed navigation on my ASP.NET Masterpage. It is pretty basic:
Pretty much what the title says really. We have some code that is .NET
I have heard mention that some desktop applications are pretty much just wrappers for
I have some pretty basic data for a pie chart. Yes: 189.84 (57.03%) No:
I have written a pretty basic upload script that takes the file and uploads
I have some random HTML layouts that contain important text I would like to
I have some pretty basic jQuery code: ... $(this).find('img').load(function(){ loadedImages++; if(loadedImages == $this.find('img').length){ ...
I have a pretty basic form that shows quiz questions along with choices: <%=

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.