I've been attempting to strategically place multiple shapes in the background using CSS, but I'm facing challenges. While I was successful with my hero section at the top of the page, positioning elements in a section halfway down has proven problematic. Whenever I set 'absolute' on the parent and 'relative' on the child, the elements end up aligning at the top.
For instance, I aim to position my first square 12% from the top and 23% from the left within the section container. Subsequently, I intend to scatter the remaining squares randomly across the page at other percentage points.
Here is a snippet of my code:
.features-section {
height: auto;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.features-section li {
height: 50px;
width: 50px;
border-radius: 5%;
display: block;
list-style: none;
}
.features-section li:nth-child(1) {
top: 12%;
left: 23%;
background: #ffa299;
opacity: 0.5;
}
<section class="features-section">
<ul class="features-animation-list">
<li></li>
<li></li>
<li></li>
</ul>
</section>
The remaining shapes will be styled as li:nth-child(2), (3), etc., so only one example is included here.
Any suggestions on how to better achieve this layout?