Style borderTopStyle property
- Previous page borderTopRightRadius
- Next Page borderTopWidth
- Go to the Previous Level HTML DOM Style Object
Definition and Usage
borderTopStyle
Sets or returns the style of the border on the element.
See also:
CSS Tutorial:CSS Border
CSS Reference Manual:border-top-style property
HTML DOM Reference Manual:border property
Example
Example 1
Add a solid top border to the <div> element:
document.getElementById("myDiv").style.borderTopStyle = "solid";
document.getElementById("myDiv").style.borderTopStyle = listValue;
document.getElementById("myDiv").style.borderTopStyle = "solid";
Example 2
Changes the top border style of the <div> element to "dotted":
document.getElementById("myDiv").style.borderTopStyle = listValue;
document.getElementById("myDiv").style.borderTopStyle = "dotted";
Example 3
Returns the top border style of the <div> element:
document.getElementById("myDiv").style.borderTopStyle = listValue;
alert(document.getElementById("myDiv").style.borderTopStyle);
Example 4
For demonstrations of all different values: var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("myDiv").style.borderTopStyle = listValue;
Try it yourself
Syntax
Sets the borderTopStyle property:Returns the borderTopStyle property:
.style.borderTopStyle
Sets the borderTopStyle property:object .style.borderTopStyle =value
|initial|inherit | Value |
---|---|
none | Description |
Defines no border. Default. | hidden |
The same as "none", but not in resolving border conflicts of table elements. | Defines a dotted border. |
dashed | Defines a dashed border. |
solid | Defines a solid border. |
double | Defines two borders. The widths of both borders are the same as the value of border-width. |
groove | Defines a 3D grooved border. The effect depends on border-color values. |
ridge | Defines a 3D ribbed border. The effect depends on border-color values. |
inset | Defines a 3D inset border. The effect depends on border-color values. |
outset | Defines a 3D outset border. The effect depends on border-color values. |
initial | Sets this property to its default value. See initial. |
inherit | Inherits this property from its parent element. See inherit. |
Technical details
Default value: | none |
---|---|
Return value: | A string representing the style of the element's top border. |
CSS version: | CSS1 |
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Previous page borderTopRightRadius
- Next Page borderTopWidth
- Go to the Previous Level HTML DOM Style Object