I am working on creating simple card items using HTML and CSS. I have successfully aligned the cards in a row on a PC, but I would like them to be displayed vertically in a column on smaller screens. Below is the code I am using.
body {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: url("/images/mainpage.jpg");
background-size: cover;
overflow: auto;
}
...
@media screen and (max-width: 600px) {
.card {
grid-template-columns: 1fr;
grid-template-rows: auto;
grid-template-areas:
"image"
"text"
"stats";
margin: 15px;
}
}
...You can inspect the element directly in the snippet to view the results. Thank you!