CSS z-index Свойство
Пример
Задайте z-индекс для изображения:
img
{
position: absolute;
left: 0px;
top: 0px;
z-index: -1;
}
Определение и использование
Свойство z-index
указывает порядок стека элемента.
Элемент с большим порядком стека всегда находится перед элементом с более низким порядком стека.
Примечание: z-index
работает только на позиционированных элементах (положение: абсолютное, положение: относительное, или положение: фиксированное).
Значение по умолчанию: | auto |
---|---|
Inherited: | no |
Animatable: | yes. Читайте о animatable |
Version: | CSS2 |
Синтаксис JavaScript: | object.style.zIndex="-1" |
Поддержка браузера
Номера в таблице указывают первую версию браузера, которая полностью поддерживает свойство.
Свойство | |||||
---|---|---|---|---|---|
z-index | 1.0 | 4.0 | 3.0 | 1.0 | 4.0 |
Синтаксис CSS
z-index: auto|number|initial|inherit;
Значения свойств
Значение | Описание | |
---|---|---|
auto | Задает порядок стека, равный его родительским. Это значение по умолчанию | |
number | Задает порядок стека элемента. Отрицательные числа разрешены | |
initial | Присваивает этому свойству значение по умолчанию. (Читайте о initial) | |
inherit | Наследует это свойство из родительского элемента. (Читайте о inherit) |
Похожие страницы
CSS Справочник: CSS Positioning
HTML DOM Справочник:
zIndex property