Build CSS media queries visually — pick device presets, set breakpoints, toggle orientation and accessibility features, then copy the generated @media code straight into your stylesheet.
Approach
Device Presets
Width & Height
px
px
px
px
Media Features
<label class="mq-feature-chip" id="mqChipScreen" onclick="mqToggleChip('mqChipScreen','mqFeatScreen')">
<span class="mq-feature-dot"></span>
<input type="checkbox" id="mqFeatScreen">
screen
</label>
<label class="mq-feature-chip" id="mqChipPrint" onclick="mqToggleChip('mqChipPrint','mqFeatPrint')">
<span class="mq-feature-dot"></span>
<input type="checkbox" id="mqFeatPrint">
print
</label>
<label class="mq-feature-chip" id="mqChipOrient" onclick="mqToggleChip('mqChipOrient','mqFeatOrient')">
<span class="mq-feature-dot"></span>
<input type="checkbox" id="mqFeatOrient">
orientation:
<select class="mq-chip-select" id="mqOrientVal" onclick="event.stopPropagation()">
<option value="portrait">portrait</option>
<option value="landscape">landscape</option>
</select>
</label>
<label class="mq-feature-chip" id="mqChipColor" onclick="mqToggleChip('mqChipColor','mqFeatColor')">
<span class="mq-feature-dot"></span>
<input type="checkbox" id="mqFeatColor">
prefers-color-scheme:
<select class="mq-chip-select" id="mqColorVal" onclick="event.stopPropagation()">
<option value="dark">dark</option>
<option value="light">light</option>
</select>
</label>
<label class="mq-feature-chip" id="mqChipMotion" onclick="mqToggleChip('mqChipMotion','mqFeatMotion')">
<span class="mq-feature-dot"></span>
<input type="checkbox" id="mqFeatMotion">
prefers-reduced-motion:
<select class="mq-chip-select" id="mqMotionVal" onclick="event.stopPropagation()">
<option value="reduce">reduce</option>
<option value="no-preference">no-preference</option>
</select>
</label>
Live Viewport Match
Generated CSS
/* Your @media query will appear here */Quick Reference — Common Breakpoints
| Name | Framework | Breakpoint | Typical Device |
|---|---|---|---|
| xs | Bootstrap | < 576px | Small phones |
| sm | Bootstrap | ≥ 576px | Phones landscape |
| md | Bootstrap | ≥ 768px | Tablets portrait |
| lg | Bootstrap | ≥ 992px | Tablets landscape / small laptop |
| xl | Bootstrap | ≥ 1200px | Desktop HD |
| xxl | Bootstrap | ≥ 1400px | Wide desktop |
| sm | Tailwind | ≥ 640px | Phones landscape |
| md | Tailwind | ≥ 768px | Tablets |
| lg | Tailwind | ≥ 1024px | Laptop / large tablet |
| xl | Tailwind | ≥ 1280px | Desktop |
| 2xl | Tailwind | ≥ 1536px | Wide / 4K |
| mobile | Custom | < 768px | Phones (portrait + landscape) |
| tablet | Custom | 768px–1199px | Tablets all orientations |
| desktop | Custom | ≥ 1200px | Laptop / desktop monitor |
| 4k | Custom | ≥ 2560px | Ultra-wide / 4K displays |
How to Use the Generator
- Choose your approach — Mobile-first outputs
min-widthqueries that scale up; desktop-first usesmax-widthto scale down. - Pick a device preset or enter custom min/max width and height values.
- Toggle media features — add orientation,
prefers-color-scheme,prefers-reduced-motion, or print. - Click Generate @media Query to see the code and the live viewport match status.
- Click Copy CSS and paste into your stylesheet.
When to Use Mobile-First vs. Desktop-First
| Mobile-First | Desktop-First | |
|---|---|---|
| Base styles target | Smallest screens | Largest screens |
| Query type | min-width | max-width |
| Progressive enhancement | Yes | No |
| Framework alignment | Tailwind, Bootstrap 4+ | Older frameworks |
Best practice: mobile-first is the modern default. It reduces specificity conflicts and keeps base styles lean.
How prefers-color-scheme Works
/* Apply dark styles only when the OS is in dark mode */
@media screen and (prefers-color-scheme: dark) {
body {
background: #0f172a;
color: #e2e8f0;
}
}
Pair this with a CSS custom-property theme to avoid duplicating declarations.
prefers-reduced-motion — Accessibility
Users who have vestibular disorders or motion sensitivity can request reduced animations at the OS level. Always respect it:
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}
Related Free Tools
- CSS Flexbox Generator — build flex containers visually
- CSS Grid Generator — define grid tracks and areas with a point-and-click interface
- Screen Resolution Checker — see your exact screen and device pixel ratio
