CSS Media Query Generator
Build mobile-first or desktop-first media queries from framework or custom breakpoints and a selector template.
css-media-query-generatorLOCAL WORKSPACE
Enabling local controls…
Settings
Use {bp} to insert a breakpoint name. Leave blank to use .{bp}. For custom breakpoints, use one name: width per line in px.
The framework presets provide common default widths in px. Check your framework version and project overrides before use.
Results
| Name | Width |
|---|---|
| sm | 640px |
| md | 768px |
| lg | 1024px |
| xl | 1280px |
| 2xl | 1536px |
CSS
/* sm */
@media (min-width: 640px) {
.sm { /* Styles */ }
}
/* md */
@media (min-width: 768px) {
.md { /* Styles */ }
}
/* lg */
@media (min-width: 1024px) {
.lg { /* Styles */ }
}
/* xl */
@media (min-width: 1280px) {
.xl { /* Styles */ }
}
/* 2xl */
@media (min-width: 1536px) {
.\32 xl { /* Styles */ }
}How to use this tool
Choose a preset or edit the controls. Copy the result or download it when it is ready.
When not to use it
The generated rule bodies are placeholders. Supply the styles your layout needs.