Computer >> Computer tutorials >  >> Programming >> Javascript

How to set the width of the bottom border with JavaScript?


To set the width of the bottom border, use the borderBottomWidth property in JavaScript. It allows you to change the width.

Example

You can try to run the following code to learn how to set the width of the bottom border −

<!DOCTYPE html>
<html>
   <body>
      <div id="box">Demo Text</div>
      <br>
      <button onclick="display()">Click to set width of bottom border</button>
      <script>
         function display() {
            document.getElementById("box").style.borderBottomStyle = "dashed";
            document.getElementById("box").style.borderBottomWidth = "5px";
         }
      </script>
   </body>
</html>