Styl boxSizing Eiendom
Voorbeeld
Verander die boxSizing-eienskap:
document.getElementById("myDIV").style.boxSizing = "border-box";
Definisie en gebruik
Die boxSizing-eienskap laat jou toe om sekere elemente te definieer om 'n area op 'n sekere manier te pas.
Byvoorbeeld, as jy twee omringde bokse langs mekaar wil hê, kan dit bereik word deur boxSizing op "border-box" te stel. Dit dwing die blaaier om die boks met die gespesifiseerde breedte en hoogte weer te gee, en plaas die rand en opvulling binne die boks.
Blaaierondersteuning
Property | |||||
---|---|---|---|---|---|
boxSizing | Yes | Yes | Yes | Yes | Yes |
Sintaksis
Gee die boxSizing-eienskap terug:
object.style.boxSizing
Stel die boxSizing-eienskap:
object.style.boxSizing = "content-box|border-box|initial|inherit"
Eiendomswaardes
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 |
Tegniese besonderhede
Standaard waarde: | inhoud-boks |
---|---|
Terugkeerwaarde: | 'n String, wat die boksgrootte-eienskap van 'n element verteenwoordig |
CSS weergawe | CSS3 |
Verwante bladsye
CSS -verwysing: boksgrootte eiendom
❮ Stylvoorwerp