I used Visual Studio Code and opened with live server.
I noticed 'position: relative' of box_1's '#red' is not working
How do you make it work?
edit image link of expecting result
also tried with unique ids
ex) red_1, orange_1, yellow_1
if possible can you tell me the reason it's not working
Thinking about conflict between ralative and float but I'm not sure
HTML
result
expecting_result
.box_1{
width: 100px;
height: 100px;
float: left;
}
.box_2{
width: 100px;
height: 100px;
}
.box_3{
width: 100px;
height: 100px;
}
#red{
background-color: red;
top: 100px;
left: 100px;
position: relative;
}
#orange{
background-color: orange;
top: 100px;
left: 100px;
position: relative;
}
#yellow{
background-color: yellow;
top: 100px;
left: 100px;
position: relative;
}
html
<div class="box_1" id="red"></div>
<div class="box_1" id="orange"></div>
<div class="box_1" id="yellow"></div>
<div class="box_2" id="red">
<div class="box_2" id="orange">
<div class="box_2" id="yellow">
</div>
</div>
</div>
<div class="box_3" id="red"></div>
<div class="box_3" id="orange"></div>
<div class="box_3" id="yellow"></div>