Can someone help me understand the concept of positioning in CSS? I created a simple code with 4 boxes that have identical width and height settings. When I position them as fixed or absolute, they look fine and identical. However, when I position them with static or relative, the boxes change proportions. I changed the border color of each box to differentiate between them.
.box {
position: static;
text-align: center;
width: 300px;
border: 25px solid;
padding: 25px;
margin: 25px;
fond-weight: bolder;
}
<div class="box" style="border-color:green;">Box1
<div><div class="box" style="border-color:yellow;">Box2
<div><div class="box" style="border-color:blue;">Box3
<div><div class="box" style="border-color:pink;">Box4
<div>
You can also view the code on the following link 1.
View the output of the code here 2.