Look around you on a bus or in a college canteen. People are on their phones. When someone opens your website, there is a good chance it is on a phone with a small screen, an average connection and one thumb doing all the work. If your site only looks good on your laptop, it doesn’t really work.
Responsive design means building pages that adapt to whatever screen they are shown on. Here is how to do it without overcomplicating things.
Step 1: The viewport meta tag
Without this tag, phones pretend to be a wide desktop screen and shrink your page down. Everything becomes tiny. Put this in the <head> of every page:
<meta name="viewport" content="width=device-width, initial-scale=1"> If your media queries don’t seem to work on a phone, check this first. It is the most common cause.
Step 2: Write mobile first CSS
Mobile first means you write your base styles for small screens, then add changes for bigger screens. It sounds backwards, but it usually leads to simpler CSS. Phones get a clean, single-column layout, and larger screens add columns and extra spacing.
/* Base: phones */
.features {
display: grid;
gap: 16px;
}
/* Tablets and up */
@media (min-width: 768px) {
.features {
grid-template-columns: 1fr 1fr;
}
}
/* Laptops and up */
@media (min-width: 1024px) {
.features {
grid-template-columns: repeat(3, 1fr);
}
} Notice the min-width. Each block says “from this width upwards, do this”. The styles build on each other.
Step 3: Choose breakpoints based on your content
Don’t try to target specific phone models. There are far too many screen sizes. Instead, slowly drag your browser window narrower and watch where your layout starts to look wrong. That is where a breakpoint belongs. The numbers above are common starting points, not rules.
Step 4: Make images flexible
A large image with a fixed width will push past the edge of a phone screen and cause sideways scrolling. This small rule fixes most of it:
img {
max-width: 100%;
height: auto;
} Also think about file size. A huge photo straight from a camera will load slowly on mobile data. Resize and compress images before you upload them, and use formats like WebP where you can.
Step 5: Use flexible units
Fixed pixel widths everywhere are what make layouts break. Some better habits:
- Use percentages or
frunits for widths where possible. - Use
max-widthon containers so text doesn’t stretch across a giant screen, likemax-width: 1100px; margin: 0 auto;. - Use
remfor font sizes so they respect the user’s browser settings. - Add side padding to your main container so text never touches the screen edge on phones.
Step 6: Think about thumbs
Responsive design is not only about layout. On a phone, people tap with a finger, not a precise mouse pointer.
- Make buttons and links big enough to tap comfortably, with space between them.
- Keep body text at a readable size. Around 16px is a sensible minimum.
- Use the right input types in forms, like
type="email"andtype="tel", so phones show the right keyboard. - Avoid features that rely on hovering. There is no hover on a touch screen.
Step 7: Handle navigation
A full row of menu links rarely fits on a small screen. Common solutions are a menu button that opens the links, or a simple stacked menu. Whatever you choose, make sure it works with a keyboard too, and that the button is clearly labelled.
Step 8: Test properly
Your browser’s developer tools have a device mode that lets you preview different screen sizes. Use it constantly while building. But also test on a real phone, ideally an ordinary one, not the latest flagship. Things to check:
- Is there any sideways scrolling?
- Can you read everything without zooming?
- Can you tap every button easily?
- Does the page load reasonably on mobile data?
That last point gets ignored a lot. A beautiful page that takes ages to load on a weak signal is not a good mobile experience.
A quick checklist
- Viewport meta tag in the head
- Mobile first CSS with
min-widthmedia queries - Images with
max-width: 100%and sensible file sizes - Flexible widths and a max-width container
- Tap-friendly buttons and readable text
- Tested on a real phone
Once these become habits, you will stop thinking of mobile as an extra step. It just becomes how you build.