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 ?


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.

链接地址: http://www.djcxy.com/p/80486.html

上一篇: 在Haskell中表示四面体数字的序列

下一篇: 在媒体查询中使用“全部”有什么好处?