Preparing your workspace
Responsive CSS allows a website layout to adapt to different screen sizes and device conditions.
A responsive website should remain usable on phones, tablets, laptops, and larger screens. Flexible layouts often use percentages, fractional units, flexbox, grid, and responsive constraints instead of relying only on fixed widths. Media queries allow CSS to change at different viewport sizes. A mobile-first approach starts with a simple small-screen layout and adds enhancements for larger screens. Responsive design is more than changing the number of columns; text size, spacing, navigation, images, and interaction areas may also need adjustment.
A course dashboard may show one column on mobile, two columns on tablets, and three or four columns on large screens.
.course-grid {
display: grid;
grid-template-columns: 1fr;
gap: 16px;
}
@media (min-width: 768px) {
.course-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (min-width: 1024px) {
.course-grid {
grid-template-columns: repeat(3, 1fr);
}
}The layout uses one column on small screens, two columns on medium screens, and three columns on larger screens.