Stile boxSizing Proprietà
Esempio
Modifica la proprietà boxSizing:
document.getElementById("myDIV").style.boxSizing = "border-box";
Definizione e utilizzo
La proprietà boxSizing consente di definire determinati elementi per adattare un'area in un determinato modo.
Ad esempio, se si desidera che due riquadri bordati uno accanto all'altro, è possibile farlo impostando il ridimensionamento su "riquadro di bordo". Ciò costringe il browser a eseguire il rendering del riquadro con la larghezza e l'altezza specificate e a posizionare il bordo e il riempimento all'interno del riquadro.
Supporto browser
Property | |||||
---|---|---|---|---|---|
boxSizing | Yes | Yes | Yes | Yes | Yes |
Sintassi
Restituisce la proprietà boxSizing:
object.style.boxSizing
Imposta la proprietà boxSizing:
object.style.boxSizing = "content-box|border-box|initial|inherit"
Valori di proprietà
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 |
Dettagli tecnici
Valore di default: | casella di contenuto |
---|---|
Valore di ritorno: | Una stringa, che rappresenta la proprietà di ridimensionamento della casella di un elemento |
Versione CSS | CSS3 |
Pagine correlate
Riferimento CSS: proprietà box-sizing
❮ Oggetto stile