Can someone help me with centering my container's item?
I am struggling to align the third item to the center using display: grid
.
Previously, I attempted to use flexbox but found it to be less effective for a responsive layout.
.projetos {
flex-direction: column;
padding: 3rem 3%;
text-align: center;
justify-content: center;
}
.projetos-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 2rem;
text-align: center;
}
.projetos-box img {
width: 100%;
max-width: 40rem;
border-radius: 1rem;
}
<section class="projetos" id="projetos">
<h2>Projetos <span>Recentes</span></h2>
<div class="projetos-container">
<div class="projetos-box">
<img src="https://via.placeholder.com/200.jpg" alt="" width="500">
</div>
<div class="projetos-box">
<img src="https://via.placeholder.com/200.jpg" alt="" width="500">
</div>
<div class="projetos-box">
<img src="https://via.placeholder.com/200.jpg" alt="" width="500">
</div>
</div>
</section>