z-index property of CSS

z-index property in CSS, is used to specify the stack order of an element.

Ex: Here we take an image as a background:

<html>

<head>

<style type="text/css">

img

{

position:absolute;

left:50px;

top:0px;

z-index:-1;

}

</style>

</head>

<body>

<img src="Penguins.jpg" width="100" height="100" />

<p><b>My Name is Mahak Garg.</b></p>

</body>

</html>


Output:


1.png

Ebook Download
View all
Learn
View all