CSS outline Свойство
Пример
Задайте структуру вокруг элемента <H2> и элемента <div>:
h2 {
outline: 5px dotted green;
}
div.a {
outline: 2px dashed blue;
}
Определение и использование
Контур представляет собой линию, которая рисуется вокруг элементов, за пределами границ, чтобы сделать элемент "выделиться".
Свойство outline
является сокращенным свойством для задания следующих свойств:
- outline-width
- outline-style (Обязательно)
- outline-color
Если цвет контура опущен, то цвет текста будет применен.
Примечание: Структура не является частью размеров элемента, поэтому свойства Width и Height элемента не содержат ширину контура.
Значение по умолчанию: | medium invert color |
---|---|
Inherited: | no |
Animatable: | yes, see individual properties. Читайте о animatable |
Version: | CSS2 |
Синтаксис JavaScript: | object.style.outline="#0000FF dotted 5px" |
Поддержка браузера
Номера в таблице указывают первую версию браузера, которая полностью поддерживает свойство.
Свойство | |||||
---|---|---|---|---|---|
outline | 1.0 | 8.0 | 1.5 | 1.2 | 7.0 |
Синтаксис CSS
outline: outline-width outline-style outline-color|initial|inherit;
Значения свойств
Значение | Описание |
---|---|
outline-width | Задает ширину контура |
outline-style | Задает стиль контура |
outline-color | Задает цвет контура |
initial | Присваивает этому свойству значение по умолчанию. (Читайте о initial) |
inherit | Наследует это свойство из родительского элемента. (Читайте о inherit) |
Похожие страницы
CSS Справочник: CSS Outline
HTML DOM Справочник: outline Свойство