Styl justify Content Property
Przykład
Zrób trochę miejsca między elementami elastycznego elementu <div>:
document.getElementById("main").style.justifyContent = "space-between";
Definicja i użycie
Właściwość justifyContent wyrównuje elementy elastycznego kontenera, gdy elementy nie zajmują całej dostępnej przestrzeni na osi głównej (w poziomie).
Porada: Użyj właściwości alignContent, aby wyrównać elementy na osi poprzecznej (w pionie).
Obsługa przeglądarki
Property | |||||
---|---|---|---|---|---|
justifyContent | Yes | 12.0 | Yes | 9.0 | Yes |
Składnia
Zwróć właściwość justifyContent:
object.style.justifyContent
Ustaw właściwość justifyContent:
object.style.justifyContent = "flex-start|flex-end|center|space-between|space-around|initial|inherit"
Wartości nieruchomości
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 |
Szczegóły techniczne
Domyślna wartość: | elastyczny start |
---|---|
Wartość zwrotu: | String, reprezentujący właściwość justify-content elementu |
Wersja CSS | CSS3 |
Powiązane strony
Odniesienie CSS: właściwość justify-content
Dokumentacja HTML DOM STYLE: właściwość alignContent
Dokumentacja HTML DOM STYLE: właściwość alignItems
HTML DOM STYLE Reference: właściwość alignSelf
❮ Obiekt stylu