JSFiddle - React, Tailwind, and code Playground

by Jacktea

HTML

<!-- These elements have IDs -->
<div id="two"></div>
<div id="one"></div>
<!-- Apply and ID and Class to Element -->
<div id="three" class="circle"></div>
<div class="circle"></div>

CSS

/* generic rules for all divs */

div{
    position: absolute; /* removes element from document flow */
    width:100px; 
    height:100px; 
    background:grey;
}

/* target elements by class using "." */
.circle {
    width: 100px;
    height: 100px;
    border-radius: 50px;
}

/* target elements by id using "#" */

#one {
    top: 50px;
    left: 25px;
    height: 200px;
    background:red;
    opacity: .7;
    z-index: 1;
}

#two {   
    top: 100px;
    background: black;
    z-index: 10;
}

#three {
    top: 50px;
    background: yellow;
    z-index: 30;
    
}