Vlastnost stylu justifyContent
Příklad
Mezi položkami flexibilního prvku <div> vytvořte mezeru:
document.getElementById("main").style.justifyContent = "space-between";
Definice a použití
Vlastnost justifyContent zarovná položky flexibilního kontejneru, když položky nevyužívají veškerý dostupný prostor na hlavní ose (horizontálně).
Tip: Použijte vlastnost alignContent k zarovnání položek na křížové ose (vertikálně).
Podpora prohlížeče
Property | |||||
---|---|---|---|---|---|
justifyContent | Yes | 12.0 | Yes | 9.0 | Yes |
Syntax
Vraťte vlastnost justifyContent:
object.style.justifyContent
Nastavte vlastnost justifyContent:
object.style.justifyContent = "flex-start|flex-end|center|space-between|space-around|initial|inherit"
Hodnoty vlastností
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 |
Technické údaje
Výchozí hodnota: | flex-start |
---|---|
Návratová hodnota: | Řetězec představující vlastnost justify-content prvku |
Verze CSS | CSS3 |
Související stránky
CSS reference: vlastnost justify-content
Odkaz na STYL DOM HTML: vlastnost alignContent
Odkaz na STYL DOM HTML: vlastnost alignItems
Odkaz na STYL DOM HTML: vlastnost alignSelf
❮ Objekt stylu