Coding task · HTML and CSS course · Module 5: Responsiveness
Responsive Flexbox grid
FLEXBOX is a flexible layout system like Egyptian columns adapting to the space! Main container properties: display: flex (activation), flex-wrap: wrap (wrapping to new lines like papyrus), justify-content (main alignment), gap (spacing). For items: flex (relative size), flex-basis (base width). Responsiveness: we change flex-basis via media queries - on mobile 100% (1 column), tablet 50% (2 columns), desktop 33.33% (3 columns). Like adjusting a columned hall to the number of priests!
Task
Create a responsive grid of Egyptian gods with Flexbox. HTML: <div class='pantheon'> + 6 <div class='god'>God X</div> + </div>. Base CSS (mobile): .pantheon {display: flex; flex-wrap: wrap; gap: 20px; padding: 20px;} .god {flex-basis: 100%; background: #FFD700; padding: 30px; text-align: center; border: 2px solid #8B4513;}. Tablet: @media (min-width: 768px) {.god {flex-basis: calc(50% - 10px);}}. Desktop: @media (min-width: 1024px) {.god {flex-basis: calc(33.33% - 14px);}}. Watch how the elements reorganize!