Javascript examples for CSS Style Property:calc
Use calc in javascript code to assign new CSS style value
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w . j a v a 2 s .co m (function() { var p = document.getElementById("test"); p.style.paddingTop = "calc("+p.style.paddingTop+" + 20px)" })(); } </script> </head> <body> <p id="test" style=" padding-top: 30px; ">This is the paragarph</p> </body> </html>