I'm using the box-sizing:border-box model. When an inline-block element with a min-width is contained in an inline-block element (container), the container is too wide in Internet Explorer 9. Works as expected in FF 10.0, Chrome 17.0, Opera 11.5 and Safari 5.1.2.
See this jsfiddle
By the way, width instead of min-width works like a charm.
Any ideas?
The box-sizing property allows us to include the padding and border in an element's total width and height. If you set box-sizing: border-box; on an element, padding and border are included in the width and height: Both divs are the same size now! Hooray!
CSS border-box is the most popular choice for setting box-sizing . It guarantees that the content box shrinks to make space for the padding and borders. Therefore, if you set your element width to 200 pixels, border-box makes sure that the content, padding, and borders fit in this number.
The border-width property sets the width of an element's four borders. This property can have from one to four values. Examples: border-width: thin medium thick 10px; top border is thin.
Hi came across your post when Googling for a similar issue with IE 8, although IE 8 supports box-sizing and min-height/width, from my tests, it seems IE 8 ignores border-box when using min-height/width on the same element
E.g.
#box {
min-height: 20px;
padding:4px;
box-sizing:border-box;
}
IE 8 height = 28px, Chrome 20 height = 20px;
Solution using css browser selectors http://rafael.adm.br/css_browser_selector/
#box {
min-height: 20px;
padding:4px;
box-sizing:border-box;
}
.ie8 #box, .ie9 #box {
min-height: 12px;
padding:4px;
}
I see the border-box value being applied in IE8 developer tools inspector. Therefore, I know border-box is working, especially as expected when width(or height) is set. But since I am using min-height for my height (and OP is using min-width), my min value is not working. The issue is therefore:
IE's min-height/min-width does not factor in border-box
.box {
padding: 30px;
box-sizing: border-box;
min-height: 200px;
}
<div class="box">Awesome Box</div>
Don't put the padding on the same element as you put the min-values AND the border-box - (you may not need border-box sizing anymore if you separate these).
.box {
box-sizing: border-box;
min-height: 200px;
}
.box-inner {
padding: 30px;
}
<div class="box">
<div class="box-inner">Awesome Box</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With