Z-index in CSS

mail@pastecode.io avatar
unknown
plain_text
5 months ago
1.0 kB
4
Indexable
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Z-index in CSS</title>
    <style>
        .container{
            height:200px;
            width:200px;
            border-radius:50%;
            position:relative;
        }
        .red{
            background-color:red;
           top:20px;
           
        } 
        .green{
            background-color:green;
            top:-100px;
            z-index:4;
        }
        .black{
            background-color:black;
            top:-320px;
            left:50px;
        }
        
        .yellow{
            background-color:yellow;
            top:-420px;
            left:50px;
        }

    </style>
</head>
<body>
    <div class="container red"></div>
    <div class="container green"></div>
    <div class="container black"></div>
    <div class="container yellow"></div>
</body>
</html>
Leave a Comment