Styl velikost boxu Vlastnost
Příklad
Změňte vlastnost boxSizing:
document.getElementById("myDIV").style.boxSizing = "border-box";
Definice a použití
Vlastnost boxSizing umožňuje definovat určité prvky, aby se určitým způsobem vešly do oblasti.
Pokud například chcete dva ohraničené boxy vedle sebe, lze toho dosáhnout nastavením boxSizing na "border-box". To přinutí prohlížeč vykreslit rámeček se zadanou šířkou a výškou a umístit ohraničení a výplň dovnitř rámečku.
Podpora prohlížeče
Property | |||||
---|---|---|---|---|---|
boxSizing | Yes | Yes | Yes | Yes | Yes |
Syntax
Vraťte vlastnost boxSizing:
object.style.boxSizing
Nastavte vlastnost boxSizing:
object.style.boxSizing = "content-box|border-box|initial|inherit"
Hodnoty vlastností
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 |
Technické údaje
Výchozí hodnota: | content-box |
---|---|
Návratová hodnota: | Řetězec představující vlastnost box-sizing prvku |
Verze CSS | CSS3 |
Související stránky
CSS reference: vlastnost box-sizing
❮ Objekt stylu