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.No | Parameters & Description |
---|---|
1 | Width For setting the bottom border width. |
2 | Style For setting the bottom border style. |
3 | Color For setting the bottom border color. |
4 | Initial For setting this property to initial value. |
5 | Inherit To inherit the parent property value. |
Example
Let us look at the example for the borderBottom property −
<!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 −