I have three cards in the middle of my page:
------ ------ ------
| | | | | |
| | | | | |
| | | | | |
------ ------ ------
I have set a 15% margin on the left and right of the cards container.
However, when I resize the screen, the cards get smaller instead of the margin getting smaller and waiting until there is only a margin of e.g. 10px left, then it should shrink the cards.
Here's my code:
.section{
min-height: 55vh;
padding: 0 15%;
display: flex;
align-items: center;
}
.cards{
margin: 0 auto;
width: 90%;
height: 47vh;
display: grid;
grid-template-columns: repeat(3,1fr);
grid-gap: 2rem;
max-width: 133rem;
}
.card{
display: grid;
grid-template-rows: repeat(5,1fr);
width: 100%;
height: 100%;
}
<div class="section">
<div class="cards">
<div class="card">
</div>
</div>
</div>
How can I get this to work without using multiple media queries? Thanks!