CSS border-top Свойство
Пример
Задайте стиль верхней границы для различных элементов:
h1 {
border-top: 5px solid red;
}
h2 {
border-top: 4px dotted blue;
}
div {
border-top: double;
}
Определение и использование
Сокращенное свойство border-top
задает все свойства верхнего края в одном объявлении.
Свойства, которые могут быть заданы, должны быть в следующем порядке:
- border-top-width
- border-top-style (Обязательно)
- border-top-color
Если граница верхнего цвета опущена, то цвет текста будет применен.
Значение по умолчанию: | medium none color |
---|---|
Inherited: | no |
Animatable: | yes, see individual properties. Читайте о animatable |
Version: | CSS1 |
Синтаксис JavaScript: | object.style.borderTop="3px dashed blue" |
Поддержка браузера
Номера в таблице указывают первую версию браузера, которая полностью поддерживает свойство.
Свойство | |||||
---|---|---|---|---|---|
border-top | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Синтаксис CSS
border-top: border-width border-style border-color|initial|inherit;
Значения свойств
Значение | Описание |
---|---|
border-top-width | Обязательно. Задает ширину верхней границы. Значение по умолчанию — "Medium" |
border-top-style | Обязательно. Задает стиль верхней границы. Значение по умолчанию — "None" |
border-top-color | Дополнительные. Задает цвет верхней границы. Значение по умолчанию — цвет текста |
initial | Присваивает этому свойству значение по умолчанию. (Читайте о initial) |
inherit | Наследует это свойство из родительского элемента. (Читайте о inherit) |
Похожие страницы
CSS Справочник: CSS Border
HTML DOM Справочник: borderTop Свойство