Mobile-First CSS
Part of the Web Development Roadmap
In short
Most people in India open websites on a phone, often on a slow connection. Designing for the small screen first keeps your CSS simpler and makes sure your biggest audience gets the best experience.
Mobile-first means writing the base styles for small screens and adding min-width media queries for larger ones. Since most Indian users browse on phones, this usually leads to simpler, faster CSS.

Think of it like this
Packing a cabin bag first
Packing for a trip, you first fill the small cabin bag with the essentials you can't do without. If you later get a bigger suitcase, you add extras. Start with the big suitcase and you'll struggle to squeeze everything into the cabin bag. Mobile-first CSS packs the essentials for phones, then adds extras for bigger screens.
Watch it happen
One page, growing with the screen
1/4No media query: one column, full-width cards, large tap targets. Every device gets these styles.
The big ideas
What you need to know
Base styles are for phones
Write your normal CSS for small screens first, with no media query around it.
Add with min-width
Use @media (min-width: ...) to add or change styles as the screen gets bigger. Each query builds on the one before.
Lighter for phones
Phones don't download or apply desktop-only layout rules they don't need, and the CSS usually ends up shorter.
Think about thumbs
Buttons and links should be at least about 44px tall on mobile, with enough space between them.
See it in code
Walk through the code
1/* Base: phones */2.products {3 display: grid;4 grid-template-columns: 1fr;5 gap: 1rem;6 padding: 1rem;7}8 9/* Tablets and up */10@media (min-width: 640px) {11 .products {12 grid-template-columns: repeat(2, 1fr);13 }14}15 16/* Laptops and up */17@media (min-width: 1024px) {18 .products {19 grid-template-columns: repeat(3, 1fr);20 max-width: 1100px;21 margin: 0 auto;22 }23}1/3The default is a single column. This is what phones use.
A product grid that goes from one to two to three columns. Remember the viewport meta tag in your HTML, or phones will ignore all of this.
Save yourself the pain
Common mistakes
Oops
Writing desktop styles first and piling on max-width queries to undo them.
Do this instead
Start with phone styles and add min-width queries. You add features instead of removing them.
Oops
Choosing breakpoints by popular phone models.
Do this instead
Pick breakpoints where your layout starts to look stretched or cramped, by dragging the window wider.
Your mission
Flip a stylesheet
Quick check
In mobile-first CSS, which media queries do you mostly use?
Go deeper
- 1Rewrite a desktop-first stylesheet so the default styles target phones.
- 2Keep tap targets at least about 44px tall so buttons are easy to press.
- 3Test your site on a real low-cost Android phone, not only in DevTools.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.