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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:52:42+00:00 2026-06-18T00:52:42+00:00

I have 2 inline-block divs with 50% widths. They both have 2 buttons each

  • 0

I have 2 inline-block divs with 50% widths. They both have 2 buttons each with 140px widths.

My expectation was that since elements are both equal in width they should also resize at the same time. What happens now is that when the containing div gets small enough so that the four buttons dont fit any more they wrap and the 2 divs resize, but before they resize equally one div gets smaller. It’s best illustrated in the jsfiddle. If you resize the browser window slowly you will see one div resizing before the other.

http://jsfiddle.net/dominicm/pcYhL/2/

HTML white-space is removed with comments and margin and padding are all set to 0.

What could be causing this and how to fix it? Any other suggestions on how to achieve the layout shown in jsfiddle?

Here’s the code for reference in case jsfiddle isn’t available later.

HTML:

<div class="menu">
  <div id="d">
      <input class="delete" type="submit" value="Delete Selected"><input class="collapse" type="button" value="Collapse All">
  </div><!--
  --><div id="p">
      <input class="expand" name="expand" type="button" value="Expand All">
  <input class="update" type="submit" value="Update Selected">
      </div>
</div>

CSS:

.menu{
    width:100%;
    height:80px;
    border-radius:7px;
    background-color:#666;
    text-align:center;
    margin:0;
    padding:0;
}
#d{
    width:50%;
    display:inline-block;
    background-color:red;
    margin:0;
    padding:0;
}
#p{
    width:50%;
    display:inline-block;
    background-color:green;
    margin:0;
    padding:0;
}

.delete{
    margin:0;
    padding:0;
    width:140px;
}
.update{
    margin:0;
    padding:0;
    width:140px;
}
.collapse{
    margin:0;
    padding:0;
    width:140px;
}
.expand{
    margin:0;
    padding:0;
    width:140px;
}
  • 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-18T00:52:43+00:00Added an answer on June 18, 2026 at 12:52 am

    The reason one was collapsing before the other was due to the differences in the HTML formatting.

    You had both buttons inline (no line-break) in the green box, and in the red box they were separated with a line break. Here are the differences I’m referring to:

    View the JSFiddle: http://jsfiddle.net/pcYhL/14/

    These buttons are not separated by a line-break or space:

    <div id="d">
         <input class="delete" type="submit" value="Delete Selected"><input class="collapse" type="button" value="Collapse All">
    </div>
    

    But these ones are…

    <div id="p">
         <input class="expand" name="expand" type="button" value="Expand All">
         <input class="update" type="submit" value="Update Selected">
    </div>
    

    If you change the second one to this:

    <div id="p">
         <input class="expand" name="expand" type="button" value="Expand All"><input class="update" type="submit" value="Update Selected">
    </div>
    

    You will noticed they collapse at the exact same time.

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

Sidebar

Related Questions

I have a div with 2 divs in it with display: inline-block since their
So basically I have 3 inline-block divs that are stacked horizontally as such: div1
If you have three identical divs positioned inline-block they are aligned perfectly. But if
I have three divs that are side-by-side using display:inline-block . If the divs are
I have 6 DIV s with display:inline-block in one line. But they have a
I have 2 block-inline divs. I don't wan't to specify the width of the
i have for example five divs, that has float:left and they are wrapped inside
I have 3 inline divs, with set width and height. They look great, then
I have the following example: http://jsfiddle.net/sSqxn/2/ The month divs are using inline-block in order
I have an li styled as follows: li{ display:inline-block; padding:5px; border:1px solid none; }

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.