English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
border-The top CSS property sets the width, style, and color of the element's top border. It sets a single top border attribute (i.e.,border-top-width,border-top-styleas well asborder-top-colorThe shorthand attribute of )
The table below provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.
Default value: | View all properties |
---|---|
Applies to: | All elements |
Inheritance: | None |
Animatable: | Yes,Please refer to individual properties.Please refer to Animation properties. |
Version: | CSS 1,2,3 |
JavaScript syntax: | object.style.borderTop="2px solid red" |
The syntax of this attribute is as follows:
border-top: [ border-top-width border-top-style border-top-color ] | initial | inherit
The following example demonstrates how to use border-top attribute.
h1 { border-top: 5px solid #ff0000; } p { border-top: 3px dotted #00ff00; }Test and see‹/›
The table below describes the value of this attribute.
Value | Description |
---|---|
border-top-width | Set the width of the top border of the element. |
border-top-style | Set the line style of the top border of the element. |
border-top-color | Set the color of the top border of the element. |
initial | Set this property to its default value. |
inherit | If specified, the associated element adopts its parent element's border-The value of the top attribute. |
border-Browser compatibility of the top attribute, the numbers in the table below represent the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.
|
See tutorial:CSS Border,CSS3 Border.
Related properties:border,border-top-color,border-top-style,border-top-width.