Proprietà di stile justifyContent
Esempio
Crea un po' di spazio tra gli elementi dell'elemento flessibile <div>:
document.getElementById("main").style.justifyContent = "space-between";
Definizione e utilizzo
La proprietà justifyContent allinea gli elementi del contenitore flessibile quando gli elementi non utilizzano tutto lo spazio disponibile sull'asse principale (orizzontale).
Suggerimento: utilizza la proprietà alignContent per allineare gli elementi sull'asse incrociato (in verticale).
Supporto browser
Property | |||||
---|---|---|---|---|---|
justifyContent | Yes | 12.0 | Yes | 9.0 | Yes |
Sintassi
Restituisce la proprietà justifyContent:
object.style.justifyContent
Imposta la proprietà justifyContent:
object.style.justifyContent = "flex-start|flex-end|center|space-between|space-around|initial|inherit"
Valori di proprietà
Value | Description |
---|---|
flex-start | Default value. Items are positioned at the beginning of the container |
flex-end | Items are positioned at the end of the container |
center | Items are positioned at the center of the container |
space-between | Items are positioned with space between the lines |
space-around | Items are positioned with space before, between, and after the lines |
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: | flex-start |
---|---|
Valore di ritorno: | Una stringa, che rappresenta la proprietà justify-content di un elemento |
Versione CSS | CSS3 |
Pagine correlate
Riferimento CSS: proprietà justify-content
HTML DOM STYLE Riferimento: proprietà alignContent
Riferimento HTML DOM STYLE: proprietà alignItems
HTML DOM STYLE Riferimento: proprietà alignSelf
❮ Oggetto stile