HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> img{ position: absolute; left: 0px; top: 0px; width: 200px; height: 150px; z-index: -1; } </style> </head> <body> <h1>CSS z-index Property</h1> <img src="car-left.png"> <p>This is a paragraph.</p> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("img")[0]; function myFunction(){ x.style.zIndex = "1"; } </script> <p><strong>Note</strong>: Click on the button to change the z-index from -1 to 1.</p> </body> </html>
OUTPUT
×

Save as Private