Responsive Design with CSS
Turn pages to read the full guide and examples
Responsive Design with CSS
An interactive learning notebook
A design for every screen
A layout may look good on desktop but overflow on a phone. Responsive design adapts spacing, columns and text so that the page remains readable and usable.
02Flexible layouts
CSS Grid is useful for card collections and page structures. Flexbox works well for navigation, button groups and one-dimensional alignment. They can be combined.
03Mini project: Card gallery
The CSS example creates two columns on larger screens and switches to one column on smaller screens. It can be adapted for a gallery or project listing.
04Code Example
Try this small example in your own practice file.
.cards {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 18px;
}
@media (max-width: 700px) {
.cards { grid-template-columns: 1fr; }
}05Choosing breakpoints
Media queries apply different styles under specified conditions. A 700px breakpoint is an example, not a universal rule. Choose breakpoints when the layout actually needs to change.
06Visual Example
Actual browser captures of the same About page at desktop (1280 px) and mobile (390 px) widths, using the site’s own HTML and CSS.

Actual website screenshots · Desktop and mobile
07The box model
An element has content, padding, border and margin. With box-sizing: border-box, padding and border are included in the specified width, making sizing easier to reason about.
08Testing and refinement
Try multiple widths in browser developer tools, including sizes between presets. Check navigation, images, readable text and touch targets. Testing on a real device adds confidence.
09Your Turn
Create a small sample page, test it at different widths and write down what you learned.
10Thanks for reading
Continue exploring the blog.
✦
Use arrow keys or swipe to turn pages