Javascript examples for CSS Style Property:padding
Change the padding of all four sides of a <div> element to "25px":
<!DOCTYPE html> <html> <head> <style> #myDiv {//from ww w . j av a2 s . com border: 1px solid #FF0000; padding: 2cm 4cm 3cm 2cm; } </style> </head> <body> <div id="myDiv">This is a div.</div> <br> <button type="button" onclick="myFunction()">Change padding</button> <script> function myFunction() { document.getElementById("myDiv").style.padding = "25px"; } </script> </body> </html>