Javascript DOM CSS Style borderBottomColor Property

Introduction

Change the color of the bottom border of a <div> element to red:

document.getElementById("myDiv").style.borderBottomColor = "red";

View in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {/*from ww w. j av  a 2s .c om*/
  border: thick solid blue;
}
</style>
</head>
<body>

<div id="myDiv">This is a div.</div>
<br>
<button type="button" onclick="myFunction()">Change color of the bottom border</button>

<script>
function myFunction() {
  document.getElementById("myDiv").style.borderBottomColor = "red";
}
</script>

</body>
</html>

The borderBottomColor property sets or gets the color of the bottom border of an element.

Property Values

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

The borderBottomColor property returns a String representing the color of an element's bottom border.




PreviousNext

Related