17

I can’t understand: is this really a bug or am I just missing out something?

I have box-sizing: border-box set for all my div within an HTML document (with all the -moz and -webkit prefixes, of course). So it means the height of a div always includes its padding. It’s reasonable to expect the min-height property to act similarly. But apparently, in Firefox it doesn’t.

I mean, when I have a div with no height set (i.e. height: auto), but with a min-height (say, 220px) and padding (say, 10px), it results in the overall height of the div being 240px instead of 220 in Firefox! It stays alright either way in Chrome and Opera, though.

Shouldn’t this be fixed, or is it some sort of a feature which I don’t get?

2
  • 1
    Well, quirksmode.org mentions that box-sizing doesn't work with min-height/min-width - quirksmode.org/css/box.html (about halfway down the page). I'm not really sure why this is though. Oct 21, 2010 at 8:46
  • That's very strange, because max-width does honour box-sizing.
    – Neil
    Jan 27, 2011 at 21:38

2 Answers 2

14

…is this really a bug… Shouldn’t this be fixed, or is it some sort of a feature which I don’t get?

It will be fixed (it's a bug not a feature).
But for now you should vote on this bug.
If it's any consolation min-/max-width seems to be working just fine though.

2
  • The Firefox team is arguing whether or not it should actually be in the CSS UI CR and want to pursue their own implementation of padding-box. This is Netscape 4 deja vu.
    – rxgx
    Nov 2, 2011 at 11:30
  • IT HAS BEEN FIXED.
    – Knu
    Feb 4, 2014 at 21:51
1

I wrote a Modernizr test to detect this constellation (min-height, padding and box-sizing: border-box). You can read more about it over at my blog or see a JSFiddle with the test and a fix applied.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.