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

JavascriptWeb DevelopmentFront End Scripts

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 −

Live Demo

<!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>
raja
Published on 27-Feb-2018 10:22:25
Advertisements