Свойство CSS align-items
Пример
Отцентрируйте выравнивание для всех элементов гибкого элемента <div>:
div
{
display: flex;
align-items: center;
}
Определение и использование
Свойство align-items
указывает выравнивание по умолчанию для элементов внутри гибкого контейнера.
Совет: Используйте свойство align-self каждого элемента, чтобы переопределить это align-items
свойство.
Значение по умолчанию: | потягиваться |
---|---|
Унаследовано: | нет |
Анимация: | нет. Читать об анимации |
Версия: | CSS3 |
Синтаксис JavaScript: | объект .style.alignItems="центр" |
Поддержка браузера
Цифры в таблице указывают на первую версию браузера, которая полностью поддерживает это свойство.
Цифры, за которыми следует -webkit-, указывают на первую версию, которая работала с префиксом.
Property | |||||
---|---|---|---|---|---|
align-items | 21.0 | 11.0 | 20.0 | 9.0 7.0 -webkit- |
12.1 |
Синтаксис CSS
align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit;
Значения свойств
Value | Description | Play it |
---|---|---|
stretch | Default. Items are stretched to fit the container | |
center | Items are positioned at the center of the container | |
flex-start | Items are positioned at the beginning of the container | |
flex-end | Items are positioned at the end of the container | |
baseline | Items are positioned at the baseline of the container | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Связанные страницы
Справочник по CSS: свойство align-content
Справочник по CSS: свойство align-self
Справочник по HTML DOM: свойство alignItems