Base Styles for Mobile
What You'll Learn
You'll learn how to write your foundational CSS targeting mobile devices first, creating a solid starting point before layering on styles for larger screens.
The Core Idea
Base styles for mobile means writing your default CSS as if you're designing for a smartphone—no media queries yet. Think of it as building the ground floor of a house before adding additional stories.
When you adopt a mobile-first approach, your initial CSS defines how everything looks on small screens (typically 320px to 480px wide). This includes:
- Single-column layouts (things stack naturally)
- Comfortable touch target sizes (buttons at least 44px tall)
- Readable font sizes (16px minimum for body text)
- Simplified navigation (hamburger menus, stacked links)
- Full-width elements that adapt to narrow viewports
Why Start with Mobile?
Mobile styles are usually simpler—content flows vertically, layouts are straightforward, and you're working with constraints. It's easier to add complexity for desktop than to strip away complexity for mobile.
A Simple Example
/* Base styles - mobile first, no media query needed */
body {
font-size: 16px;
padding: 1rem;
}
.card {
display: flex;
flex-direction: column;
width: 100%;
gap: 1rem;
}
button {
min-height: 44px;
padding: 0.75rem 1.5rem;
font-size: 1rem;
}
Notice there's no @media query here—these styles apply everywhere but are optimized for mobile constraints. Later, you'll add media queries to enhance the experience on tablets and desktops.
Key Takeaway: Base mobile styles are your default CSS without media queries, designed for small screens with simple layouts, readable text, and touch-friendly elements—building up from the simplest use case first.