Add 20 px to CSS paddingTop - Javascript CSS Style Property

Javascript examples for CSS Style Property:paddingTop

Description

Add 20 px to CSS paddingTop

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from ww 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>

Related Tutorials