The min / max width / height properties never take into account any other box sizes, borders, or padding. They limit only the used values โโof the width
and height
properties, respectively. Section 10 in CSS2.1 does not explicitly mention borders or additions in prose for the min / max properties, but this refers to width
and height
, both of which relate to the size of the content.
If you set height: 50px
, the element will still be limited to a content height of 40 pixels. Then the filling extends from the content area.
Unfortunately, it seems that box-sizing: border-box
does not apply to this completely, at least when the borders and / or padding do not exceed the width and height.
Although I can conclude that this is due to the fact that browsers follow the specification, why the specification was written in such a way that I can not answer objectively. Given that indentation and overflow can work together, I don't think the reason for this behavior has anything to do with overflow.
source share