Свойство стиля justifyContent
Пример
Сделайте некоторое пространство между элементами гибкого элемента <div>:
document.getElementById("main").style.justifyContent = "space-between";
Определение и использование
Свойство justifyContent выравнивает элементы гибкого контейнера, когда элементы не используют все доступное пространство на главной оси (по горизонтали).
Совет: Используйте свойство alignContent для выравнивания элементов по поперечной оси (по вертикали).
Поддержка браузера
Property | |||||
---|---|---|---|---|---|
justifyContent | Yes | 12.0 | Yes | 9.0 | Yes |
Синтаксис
Верните свойство justifyContent:
object.style.justifyContent
Установите свойство justifyContent:
object.style.justifyContent = "flex-start|flex-end|center|space-between|space-around|initial|inherit"
Значения свойств
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 |
Технические детали
Значение по умолчанию: | гибкий старт |
---|---|
Возвращаемое значение: | Строка, представляющая свойство justify-content элемента. |
CSS-версия | CSS3 |
Связанные страницы
Справочник по CSS: свойство justify-content
HTML DOM STYLE Справка: свойство alignContent
HTML DOM STYLE Справка: свойство alignItems
HTML DOM STYLE Справка: свойство alignSelf
❮ Объект стиля