Style boxSizing Property
Exemple
Modifiez la propriété boxSizing :
document.getElementById("myDIV").style.boxSizing = "border-box";
Définition et utilisation
La propriété boxSizing vous permet de définir certains éléments pour s'adapter à une zone d'une certaine manière.
Par exemple, si vous voulez deux boîtes bordées côte à côte, cela peut être réalisé en définissant boxSizing sur "border-box". Cela oblige le navigateur à rendre la boîte avec la largeur et la hauteur spécifiées, et à placer la bordure et le rembourrage à l'intérieur de la boîte.
Prise en charge du navigateur
Property | |||||
---|---|---|---|---|---|
boxSizing | Yes | Yes | Yes | Yes | Yes |
Syntaxe
Renvoyez la propriété boxSizing :
object.style.boxSizing
Définissez la propriété boxSizing :
object.style.boxSizing = "content-box|border-box|initial|inherit"
Valeurs de propriété
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 |
Détails techniques
Valeur par défaut: | boîte de contenu |
---|---|
Valeur de retour : | Une chaîne, représentant la propriété box-sizing d'un élément |
Version CSS | CSS3 |
Pages connexes
Référence CSS : propriété box-sizing
❮ Objet de style