Media queries have long used the Boolean and operator to stack conditions — a media type here, a width feature there — and that pattern is the backbone of responsive design. Media Queries Level 4 adds a second way to express the same ideas: comparison operators that put the value, the operator and the threshold on one line.
The operators
The spec introduces five comparison operators for media features:
<— less than another value>— greater than another value=— equal to another value<=— less than or equal to another value>=— greater than or equal to another value
A common query written the old way, matching viewports 600px wide or more:
@media (min-width: 600px) {
.element {
/* Style away! */
}
}
The same condition with the new syntax:
@media (width >= 600px) {
.element {
/* Style away! */
}
}
Defining a breakpoint range
Breakpoints are usually a band between two widths: where the design collapses and where it recovers. Combining min-width and max-width with and gets you there:
/* When the viewport width is between 30em - 80em */
@media screen and (min-width: 30em) and (max-width: 80em) {
.element {
/* Style away! */
}
}
The range form is shorter and its intent is legible at a glance:
@media (400px <= width <= 1000px) {
/* etc. */
}
Why the comparison form is clearer
Part of the gain is cosmetic. width >= 320px reads more directly than sorting out which of min-width and max-width you need with an and between them. Dropping the min-/max- prefix leaves a single width feature, and the operator carries the rest of the meaning.
The two spellings also differ in behavior. The prefixed features map onto the operators as follows:
max-widthis equivalent to<=:(max-width: 320px)means the same as(width <= 320px).min-widthis equivalent to>=:(min-width: 320px)means the same as(width >= 320px).- Neither corresponds to the strict
<or>operators.
The Media Queries Level 4 spec works through a breakpoint at 320px that illustrates the trap:
@media (max-width: 320px) { /* styles for viewports <= 320px */ }
@media (min-width: 320px) { /* styles for viewports >= 320px */ }
Both queries match at exactly 320px, so both style sets apply at once. One workaround pushes the second query up a pixel:
@media (max-width: 320px){ /* styles for viewports <= 320px */ }
@media (min-width: 321px){ /* styles for viewports >= 321px */ }
That ends the overlap, but now anything strictly between 320px and 321px matches neither query — a sliver with no styles at all. Scaling the decimal further, to 320.01px, closes the gap but the query is getting absurd. The range syntax states the intent without the arithmetic:
@media (width <= 320px) { /* styles for viewports <= 320px */ }
@media (width > 320px) { /* styles for viewports > 320px */ }
A range-based layout in practice
A responsive layout usually starts from base styles shared everywhere, then narrows through breakpoints toward tablet and phone sizes:


At the lower end, a nav list that was hidden becomes visible and .title inside main grows. The switch fires when the viewport crosses from one query's conditions into another's:
/* Base styles (any screen size) */
header {
display: flex;
justify-content: center;
}
header ul {
display: none;
}
.title p {
font-size: 3.75rem;
}
/* When the media type is a screen with a width greater or equal to 768px */
@media screen and (width >= 768px) {
header {
justify-content: space-between;
}
header ul {
display: flex;
justify-content: space-between;
gap: 3rem;
}
.title p {
font-size: 5.75rem;
}
}
That query mixes old and new syntax: it constrains the media type to screen, compares width with a range operator, and joins the two with and.

The two extremes are covered — phones below 768px and anything at or above it. The desktop tier is left, so at a breakpoint of 1000px:
mainbecomes a 12-column grid.- A button appears over the image.
.titleincreases infont-sizeand overlaps the image.
/* When the media type is a screen with a width greater or equal to 1000px */
@media screen and (width >= 1000px) {
/* Becomes a 12-column grid */
main {
display: grid;
grid-template-columns: repeat(12, 1fr);
grid-template-rows: auto 250px;
}
/* Places the .title on the grid */
.title {
grid-row: 1;
}
/* Bumps up the font-size */
.title p {
font-size: 7.75rem;
}
/* Places .images on the grid */
.images {
grid-row: 1 / span 2;
align-self: end;
position: relative;
}
/* Displays the button */
.images .button {
display: block;
position: absolute;
inset-block-end: 5rem;
inset-inline-end: -1rem;
}
}

Support today
Firefox and Chromium browsers already implement the range syntax; Safari is the remaining major engine without it, with an open bug at bugs.webkit.org/show_bug.cgi?id=180234 tracking the work. Per Caniuse, the version numbers below mark the first release in each browser that supports the feature and every version after it.
Desktop
| Chrome | Firefox | IE | Edge | Safari |
|---|---|---|---|---|
| 104 | 63 | No | 104 | 16.4 |
Mobile / Tablet
| Android Chrome | Android Firefox | Android | iOS Safari |
|---|---|---|---|
| 157 | 160 | 157 | 16.4 |
Beyond width, the same comparison operators apply to other range media features in the Level 4 spec, such as height and aspect-ratio.



