Box-sizing:border-box and min-width problem in IE 9
Using box-sizing:border-box, when an inline-block element with a min-width is contained in an inline-block container, the container is too wide in IE 9. Works as expected in FF 10.0, Chrome 17.0, Opera 11.5 and Safari 5.1.2
<p>
In IE9 the containers of both these boxes are affected by the min-width of their content elements in an incorrect way. You'll see the red backgrounds of the containers at the right in IE9.
Seems like the containers get an extra width equal to the sum of the borders and the padding of the content elements.
</p>
<p>
The containers and the content elements have <b>box-sizing:border-box</b> and <b>display:inline-block</b>. The content elements have <b>min-width:260px</b>.
</p>
<p>
By the way, <b>width</b> instead of <b>min-width</b> works like a charm.
</p>
<ul>
<li>
<a href="#">This has min-width set</a>
</li>
</ul>
<div>
<span>This has min-width set</span>
</div>
CSS
* {
box-sizing: border-box;
-moz-box-sizing: border-box;
}
li, div {
display: inline-block;
background-color: red;
margin-bottom: 10px;
}
a, span {
display: inline-block;
padding: 10px;
border: 20px solid lime;
background-color: yellow;
min-width: 260px;
}
body {
margin: 30px;
font-family: sans-serif;
font-size: 16px;
line-height: 1.6;
}
p {
margin-bottom: 20px;
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.