borderTopStyle Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:borderTopStyle

Description

The borderTopStyle property sets or gets the top border style.

Property Values

Value Description
noneNo border will be displayed.
hidden Same as 'none'
dotted a series of dots.
dashed a series of short line segments i.e. dashes.
solid a single solid line.
double a two parallel solid lines.
groove Looks like carved into the canvas.
ridge opposite effect of 'groove'.
inset Looks like embedded in the canvas.
outset opposite effect of 'inset'.
initial Sets this property to its default value.
inherit takes the computed value of its parent element border-bottom-style property.

Technical Details

Item Value
Default Value: none
Return Value: A String, representing the style of an element's top border
CSS VersionCSS1

Get top border of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv" style="border-top:double;">This is a div.</div>
<br>
<button type="button" onclick="myFunction()">Return top border style</button>

<script>
function myFunction() {/*from   w  w  w  . ja  v a  2 s  . c o  m*/
    console.log(document.getElementById("myDiv").style.borderTopStyle);
}
</script>

</body>
</html>

Related Tutorials