I attempted to center a div containing 2 photos perfectly in the center, but encountered some issues. Despite trying various positioning techniques such as display: flex, align-items, justify-content, and more, I couldn't get the image container to move to the center.
Below is my code:
.grid {
display: grid;
gap: 1.5rem;
}
.section {
padding: 4.5rem 0 2rem;
}
.home_container {
position: relative;
align-items: center;
justify-content: center;
}
.home_images {
position: absolute;
display: flex;
left: 50%;
top: 50%;
}
.home_big-img {
z-index: 12;
}
.home_small-img {
transform: translateX(-9rem);
}
<section class="section home grid">
<div class="home_container container">
<div class="home_images">
<img src="./img/man.png" alt="" class="home_big-img">
<img src="./img/plane.png" alt="" class="home_small-img">
</div>
</div>
</section>
One of the images can be viewed here:
https://i.sstatic.net/yh2Ld.png
The second image can be found here: