CSS Media Queries & Responsive Breakpoints (2026 Guide)
CSS media queries tested in Chromium 141: why a phone gets desktop styles without the viewport meta tag (980 px layout), how em breakpoints follow a user's larger default font while px ones do not, and what hover, pointer and preference queries report on desktop and phone.
Media Query Syntax, Including Ranges
A media query applies a block of CSS only when its conditions are true. The classic form uses min-width and max-width; the newer range syntax reads like math and avoids off-by-one gaps between breakpoints:
@media (min-width: 768px) and (max-width: 1199.98px) { ... }
@media (768px <= width < 1200px) { ... } /* same range, no gap */
MDN's compatibility data lists range syntax in Chrome 104, Firefox 102 and Safari 16.4, so it is safe for most sites today; keep min-width forms if you still support older Safari.
The Tag That Makes Breakpoints Work on Phones
Without <meta name="viewport" content="width=device-width, initial-scale=1">, mobile browsers lay a page out as if the screen were about 980 pixels wide and then shrink it. We loaded the same page on an emulated 390-pixel phone in Chromium 141: without the tag the layout width was 980 px and (min-width: 640px) matched, so the phone got desktop styles; with the tag the width was 390 px and the query no longer matched. Every responsive page needs that one line in its head.
Choosing Breakpoints
Set breakpoints where your layout starts to break, not at device sizes; devices change every year and sit at every width. Framework defaults are a reasonable starting grid: Tailwind CSS uses 640, 768, 1024, 1280 and 1536 px, and Bootstrap 5.3 uses 576, 768, 992, 1200 and 1400 px, all as minimum widths. Write styles mobile first, with base styles for small screens and min-width queries adding layout as space grows, so small screens download no overrides they do not use. Our breakpoints guide tests this in detail.
px or em Breakpoints?
In a media query, em is based on the browser's default font size, not on your page's root font size. We raised Chromium's default font size from 16 to 32 px in a 1,000-pixel window: (min-width: 640px) still matched, but (min-width: 40em), the same breakpoint at the default size, stopped matching (matches at 16 px, no at 32 px). Em breakpoints therefore move to a narrower layout for people who enlarge their text, which is usually what they need; pixel breakpoints ignore that setting. Browser zoom affects both equally.
Input and Preference Queries
| Query | Desktop | Phone (touch) | Use it for |
|---|---|---|---|
(hover: hover) | matches | no | Hover-only reveals and tooltips |
(pointer: coarse) | no | matches | Larger tap targets |
(prefers-reduced-motion: reduce) | when set in the OS | when set in the OS | Turning off non-essential animation |
(prefers-color-scheme: dark) | when set in the OS | when set in the OS | Dark theme |
Reduced-motion and color-scheme support goes back years (Chrome 74 and 76, Firefox 63 and 67, Safari 10.1 and 12.1 per MDN). Emulating both in Chromium flipped the queries as expected, which is also how to test them: browser developer tools can emulate these preferences without changing your system settings.
When to Use Container Queries Instead
Media queries ask about the viewport; container queries ask about the element's container, so a card can switch layout in a narrow sidebar and a wide main column on the same page. @container works in Chrome 105, Firefox 110 and Safari 16. Use media queries for page-level layout and preferences, and container queries for components; our container queries guide covers the setup and its traps.
Frequently Asked Questions
What is a CSS media query?
What are the standard responsive breakpoints?
What is mobile-first CSS?
What are container queries?
Should I use px or em for breakpoints?
Use the Media Query Generator โ free, no signup required.
โก Open Media Query Generator- [1]W3C, Media Queries Level 4: range context and relative units based on initial values โ
- [2]MDN browser-compat-data 8.1.3: media range syntax, prefers-reduced-motion, prefers-color-scheme, hover, pointer โ
- [3]MDN, Viewport meta tag โ
- [4]Tailwind CSS documentation, Responsive design โ
- [5]Bootstrap 5.3 documentation, Breakpoints โ