How do I make div3 & div4 above div1 and div2 without using "ID" selector on CSS level?
.container {
margin: 50px;
padding: 20px;
text-align: center;
border: 1px dashed #999966;
}
.position {
height: 120px;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
margin-bottom: 10px;
opacity: 0.8;
border: 1px dashed #999966;
background-color: #ffffcc;
}
.position .position {
margin-top: 60px;
margin-left: 100px;
width: 50%;
}
.relative {
position: relative;
border: 1px dashed #669966;
background-color: #ccffcc;
}
.fixed {
position: fixed;
border: 1px dashed #669966;
background-color: #e3e3ff;
align-items: flex-start;
}
.fixed.target-block {
width: 200px;
height: 300px;
top: 130px;
right: 140px;
z-index: 999;
}
<div class="container">
<p>
DIV: CONTAINER<br>
position: relative;
</p>
<div class="position">
<p>
DIV #1<br>
no position;
</p>
<div class="position relative">
<p>
DIV #3<br>
position: relative;<br>
parent
</p>
<div class="position fixed target-block">
<p>
DIV #4<br>
position: fixed;<br>
child
</p>
</div>
</div>
</div>
<div class="position">
<p>
DIV #2<br>
no position;
</p>
</div>
</div>