borderTopColor Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:borderTopColor

Description

The borderTopColor property sets or gets the top border's color.

Property Values

Value Description
color Sets the color of the top border. Default color is black
transparent The color of the top border is transparent
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

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

Get the color of the top border of a <div> element

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<script>
function myFunction() {/*from   ww w  . j  av  a2  s .  c  om*/
    console.log(document.getElementById("myDiv").style.borderTopColor);
}
</script>

</body>
</html>

Related Tutorials