jpotapova
jpotapova

Reputation: 296

What is the benefit of using 'all' in a media query?

What is the difference between

@media all and (min-width: 500px) {
     // some css
}

and

@media (min-width: 500px) {
     // some css
}

Quite often I see the first declaration, but is there any benefit of including all?

Upvotes: 7

Views: 193

Answers (1)

nullability
nullability

Reputation: 10677

There is no benefit. According to MDN:

Unless you use the not or only operators, the media type is optional and the all type will be implied.

The all type is implied, so @media (min-width: 500px) is interpreted as @media all and (min-width: 500px) and the two statements are equivalent. The latter is just needlessly specific.

Upvotes: 4

Related Questions