Coding task · HTML and CSS course · Module 5: Responsiveness

Responsive CSS card grid

A responsive card grid is like a gallery of pharaoh portraits - on a small screen we display them in one column, on a tablet in two, and on desktop in three! Use CSS Grid with repeat(auto-fit, minmax()) for automatic responsiveness without media queries. It's like a magical grid that automatically adjusts the number of columns to the available space!

Task

Create a responsive card grid of Egyptian gods. HTML: <div class='cards-grid'><div class='card'><h2>Ra</h2><p>God of the Sun</p></div><div class='card'><h2>Anubis</h2><p>God of the Dead</p></div><div class='card'><h2>Isis</h2><p>Goddess of Magic</p></div><div class='card'><h2>Horus</h2><p>God of the Sky</p></div><div class='card'><h2>Thoth</h2><p>God of Knowledge</p></div><div class='card'><h2>Bastet</h2><p>Goddess of Cats</p></div></div>. CSS: .cards-grid {display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; padding: 20px;} .card {background: #FFD700; padding: 30px; text-align: center; border: 2px solid #8B4513; border-radius: 10px;}.