Javascript examples for CSS Style Property:padding
Return the padding of a <div> element:
<!DOCTYPE html> <html> <head> <style> #myDiv {// w w w . j a va 2 s . c o m border: 1px solid #FF0000; } </style> </head> <body> <div id="myDiv" style="padding:2cm 4cm 3cm 5cm;">This is a div.</div> <br> <button type="button" onclick="myFunction()">Return padding</button> <script> function myFunction() { console.log(document.getElementById("myDiv").style.padding); } </script> </body> </html>