HTML DOM Style borderBottom Property


The borderBottom property is used for setting or getting the bottom border properties. The border-bottom property is a short hand for border-bottom-width, border-bottom-style, border-bottom-color.

Syntax

Following is the syntax for −

Setting the borderBottom property −

object.style.borderBottom = "width style color|initial|inherit"

Values

Following are the above property values −

Sr.NoParameters & Description
1Width
For setting the bottom border width.
2Style
For setting the bottom border style.
3Color
For setting the bottom border color.
4Initial
For setting this property to initial value.
5Inherit
To inherit the parent property value.

Example

Let us look at the example for the borderBottom property −

Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
   #IMG1 {
      border-bottom: 7px solid orange;
      box-shadow: 2px 2px 4px 1px seagreen;
   }
</style>
<script>
   function changeBorder(){
      document.getElementById("IMG1").style.borderBottom="10px dotted pink";
      document.getElementById("Sample").innerHTML="The bottom border for the image is now changed";
   }
</script>
</head>
<body>
<h2>Kotlin Tutorial</h2>
<img id="IMG1" src="https://www.tutorialspoint.com/kotlin/images/kotlin.jpg">
<p>Change the above image below border by clicking the below button</p>
<button onclick="changeBorder()">Change Bottom Border</button>
<p id="Sample"></p>
</body>
</html>

Output

This will produce the following output −

On clicking the “Change Bottom Border” button −

Updated on: 15-Feb-2021

16 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements