Responsive Design
What is Responsive Design?
Responsive design makes websites adapt to different screen sizes and devices. Your site should look great on phones, tablets, and desktops!
Media Queries Basics
Media queries apply CSS rules based on screen size. Syntax:
@media (condition) { /* CSS */ }
Common Breakpoints
Standard breakpoints for different devices:
- Mobile: 320px - 480px
- Tablet: 481px - 768px
- Desktop: 769px - 1024px
- Large Desktop: 1025px+
Mobile-First Approach
Start with mobile styles, then add complexity for larger screens using
min-width. This is the modern best practice!
Responsive Grid Layout
Change grid columns based on screen size for optimal layouts on all devices.
Hiding Elements
Show or hide elements based on screen size using
display: none.
Responsive Typography
Adjust font sizes for better readability on different screens.
Responsive Navigation
Transform horizontal desktop navigation into a vertical mobile menu.
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
Best Practices
- Use mobile-first approach with
min-width - Test on real devices, not just browser resize
- Use relative units (%, em, rem) over fixed pixels
- Keep breakpoints simple (3-4 is usually enough)
- Optimize images for different screen sizes
- Touch targets should be at least 44×44px on mobile
Quick Quiz
Which approach is recommended for responsive design?
Enjoying these tutorials?