Style boxSizing Property
Example
Change the boxSizing property:
document.getElementById("myDIV").style.boxSizing="border-box";
Try it »
Definition and Usage
The boxSizing property allows you to define specific elements that match a certain area in a specific way.
For example, if you need to place two bordered boxes side by side, you can do this by setting boxSizing to "border-box". This makes the browser render a box with the specified width and height, and place the border and padding inside the box.
Browser support

Internet Explorer, Opera, Chrome, and Safari support the boxSizing property.
Firefox supports an alternative property to this one, namely the MozBoxSizing property.
Syntax
Return the boxSizing property:
object
.style.boxSizing
Set the boxSizing property:
object
.style.boxSizing="content-box|border-box|initial|inherit"
Attribute values
| Value | Description |
|---|---|
| content-box | Default value. This is the behavior of width and height as defined by CSS2.1. The specified width and height (and the min/max properties) apply to the content box width and height of the element. The element's padding and border are drawn outside the specified width and height. |
| border-box | The specified width and height of an element (and the min/max properties) determine the element's border box. That is, any padding and border specified for the element are drawn within the already-set width and height. The content width and height are obtained by subtracting the border and padding from the set 'width' and 'height' properties respectively. |
| initial | Sets this property to its default value. See initial. |
| inherit | Inherits this property from its parent element. See inherit. |
Technical Details
| Default value: | content-box |
|---|---|
| Return Value: | A string that represents the box-sizing property of an element. |
| CSS version | CSS3 |
Related Articles
CSS Reference Manual:box-sizing property
The Style object