Свойство стиля alignSelf
Пример
Установите выравнивание для одного из элементов внутри гибкого элемента, чтобы он соответствовал контейнеру:
document.getElementById("myBlueDiv").style.alignSelf = "stretch";
Определение и использование
Свойство alignSelf указывает выравнивание для выбранного элемента внутри гибкого контейнера.
Примечание. Свойство alignSelf переопределяет свойство alignItems гибкого контейнера.
Поддержка браузера
Цифры в таблице указывают на первую версию браузера, которая полностью поддерживает это свойство.
Цифры, за которыми следует Webkit, указывают на первую версию, которая работала с префиксом.
Property | |||||
---|---|---|---|---|---|
alignSelf | 21.0 | 11.0 | 20.0 | 9.0 7.0 Webkit |
12.1 |
Синтаксис
Вернуть свойство alignSelf:
object.style.alignSelf
Установите свойство alignSelf:
object.style.alignSelf = "auto|stretch|center|flex-start|flex-end|baseline|initial|inherit"
Значения свойств
Value | Description |
---|---|
auto | Default. The element inherits its parent container's align-items property, or "stretch" if it has no parent container |
stretch | The element is positioned to fit the conatiner |
center | The element is positioned at the center of the container |
flex-start | The element is are positioned at the beginning of the container |
flex-end | The element is positioned at the end of the container |
baseline | The element is 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 |
Технические детали
Значение по умолчанию: | авто |
---|---|
Возвращаемое значение: | Строка, представляющая свойство align-self элемента |
CSS-версия | CSS3 |
Связанные страницы
Справочник по CSS: свойство align-self
HTML DOM STYLE Справка: свойство alignContent
HTML DOM STYLE Справка: свойство alignItems