Im working on a project with a similar layout to this
https://i.sstatic.net/okRL1.png
I am trying to achieve a chessboard effect in my grid layout, where the last element of one row has the same background color as the first element of the next row.
I have set up my container using CSS grid and placed some cards inside it. Is there a way I can achieve this effect using only CSS?
.cards-container {
display: grid;
grid-template-columns: repeat(2, 10rem);
}
.card {
border: 1px solid black;
}
.cards-container > a:nth-child(odd) {
background-color: #4268af;
}
<div class="cards-container">
<a class="card">
<h4 class="card-name">name</h4>
</a>
<a class="card">
<h4 class="card-name">name</h4>
</a>
<a class="card">
<h4 class="card-name">name</h4>
</a>
<a class="card">
<h4 class="card-name">name</h4>
</a>
<a class="card">
<h4 class="card-name">name</h4>
</a>
<a class="card">
<h4 class="card-name">name</h4>
</a>
</div>