Change Element width via css style at runtime - Javascript CSS Style Property

Javascript examples for CSS Style Property:width

Description

Change Element width via css style at runtime

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <style type="text/css">

#box{//from   w w w.ja  v  a  2  s  .co m
   height:100px;
   border:3px;
   border-style:solid;
   border-color:#000;
}

      </style> 
   </head> 
   <body> 
      <div id="box"></div> 
      <script type="text/javascript">
        document.getElementById('box').style.width="10px";
    
      </script>  
   </body>
</html>

Related Tutorials