{{ CSSMozExtensionRef() }}
Summary
-moz-box-sizing
is used by mozilla browsers to alter the default CSS box model used to calculate widths and heights of elements. It is possible to use this property to allow mozilla to emulate the behavior of browsers that do not correctly support the CSS box model specification. Some other browsers support box-sizing
as specified in CSS3.
- {{ Xref_cssinitial() }}: {{ Cssxref("content-box") }}
- Applies to: all elements
- {{ Xref_cssinherited() }}: no
- Percentages: n/a
- Media: {{ Xref_cssvisual() }}
- {{ Xref_csscomputed() }}: as specified
Syntax
-moz-box-sizing: content-box | border-box | padding-box
Values
- content-box
- This is the default style as specified by the CSS standard. The width and height properties are measured including only the content, but not the border, margin, or padding.
- padding-box
- The width and height properties include the padding size, and do not include the border or margin.
padding-box
isn't part of CSS3-UI and only supported by Firefox (Gecko). - border-box
- The width and height properties include the padding and border, but not the margin. This is the box model used by Internet Explorer when the document is not in Standards-compliant mode .
Examples
/* support Firefox, Safari/WebKit, Opera and IE8 */ .example { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
Specifications
- CSS3 Basic User Interface #box-sizing
- CSS3 Advanced Layout #box-sizing (early working draft, expected to change)
Browser compatibility
Browser | Lowest Version |
---|---|
Internet Explorer | 8.0 box-sizing |
Firefox | 1.0 -moz-box-sizing |
Opera | 7.0 box-sizing |
Safari | 3.0 -webkit-box-sizing |
{{ languages( { "fr": "fr/CSS/-moz-box-sizing", "pl": "pl/CSS/-moz-box-sizing" } ) }}