Thanks to visit codestin.com
Credit goes to www.tutorialspoint.com

Set Bottom Padding of an Element with JavaScript



To set the bottom padding, use the paddingBottom property in JavaScript.

Example

You can try to run the following code to return the bottom padding of an element with JavaScript −

<!DOCTYPE html>
<html>
   <head>
      <style>
         #box {
            border: 2px solid #FF0000;
            width: 150px;
            height: 70px;
         }
      </style>
   </head>
   <body>
      <div id = "box">This is demo text.</div>
      <br>
      <br>
      <button type = "button" onclick = "display()">Bottom padding</button>
     
      <script>
         function display() {
            document.getElementById("box").style.paddingBottom = "100px";
         }
      </script>
   </body>
</html>
Updated on: 2020-06-23T11:21:20+05:30

639 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements