Javascript examples for CSS Style Property:width
Change the width of a <div> element:
<!DOCTYPE html> <html> <head> <style> #myDIV {/*w w w . j a va 2 s . c om*/ width: 100px; height: 100px; background-color: coral; color: white; } </style> </head> <body> <button onclick="myFunction()">Test</button> <div id="myDIV"> <h1>myDIV</h1> </div> <script> function myFunction() { document.getElementById("myDIV").style.width = "500px"; } </script> </body> </html>