HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>CSS margin Property</h1> <p>This is a paragraph.</p> <div style=" border: 1px solid black;">This is a div</div> <p>This is a paragraph.</p> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("div")[0]; function myFunction(){ x.style.margin = "50px"; } </script> <p><strong>Note</strong>: click on the button to apply css 'margin' property.</p> </body> </html>
OUTPUT
×

Save as Private