StijlboxSizing Property _
Voorbeeld
Wijzig de eigenschap boxSizing:
document.getElementById("myDIV").style.boxSizing = "border-box";
Definitie en gebruik
Met de eigenschap boxSizing kunt u bepaalde elementen definiëren om op een bepaalde manier in een gebied te passen.
Als u bijvoorbeeld twee kaders naast elkaar wilt, kan dit worden bereikt door boxSizing in te stellen op "border-box". Dit dwingt de browser om het vak weer te geven met de opgegeven breedte en hoogte, en de rand en opvulling in het vak te plaatsen.
Browserondersteuning
Property | |||||
---|---|---|---|---|---|
boxSizing | Yes | Yes | Yes | Yes | Yes |
Syntaxis
Retourneer de eigenschap boxSizing:
object.style.boxSizing
Stel de eigenschap boxSizing in:
object.style.boxSizing = "content-box|border-box|initial|inherit"
Eigendomswaarden
Value | Description |
---|---|
content-box | Default value. This is the behavior of width and height as specified by CSS2.1. The specified width and height (and min/max properties) apply to the width and height respectively of the content box of the element. The padding and border of the element are laid out and drawn outside the specified width and height |
border-box | The specified width and height (and min/max properties) on this element determine the border box of the element. That is, any padding or border specified on the element is laid out and drawn inside this specified width and height. The content width and height are calculated by subtracting the border and padding widths of the respective sides from the specified 'width' and 'height' properties |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technische details
Standaardwaarde: | inhoud-box |
---|---|
Winstwaarde: | Een tekenreeks, die de eigenschap van de doosgrootte van een element vertegenwoordigt |
CSS-versie | CSS3 |
Gerelateerde pagina's
CSS-referentie: eigenschap box-sizing
❮ Stijlobject