Adding the CSS
✍️ Objective - To add design to the category divs
/* layout.css */
/* ... other existing styles ... */
.container {
display: flex;
overflow-x: auto;
width: 100%;
padding: 1rem;
}
.category-card {
flex: 0 0 auto;
width: 200px;
margin-right: 1rem;
text-align: center;
background-color: #fff;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
border-radius: 5px;
overflow: hidden;
}
.category-link {
text-decoration: none;
color: inherit;
}
.category-image-wrapper {
width: 100%;
height: 0;
padding-bottom: 100%;
position: relative;
}
.category-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.category-name {
padding: 1rem;
font-size: 1.1rem;
font-weight: bold;
}
/* Media queries for responsiveness */
@media (min-width: 480px) {
.category-card {
width: calc(50% - 1rem);
}
}
@media (min-width: 768px) {
.category-card {
width: calc(33.333% - 1rem);
}
}
@media (min-width: 992px) {
.category-card {
width: calc(25% - 1rem);
}
}
@media (min-width: 1200px) {
.category-card {
width: 200px;
}
}
Last updated