在媒体查询中使用或不使用 all 这个词有什么区别?
What is the difference between using or not the word all in media queries?
这两者有什么区别:
@media all and (orientation: portrait){}
@media(orientation:portrait){}
我一直认为默认情况下媒体查询会影响所有媒体,因此没有必要这样做,但最近我经常看到这种情况,我不再确定了。
真的有区别吗?
A shorthand syntax is offered for media queries that apply to all media types; the keyword ‘all’ can be left out (along with the trailing ‘and’). I.e. if the media type is not explicitly given it is ‘all’.
即这些是相同的:
@media all and (min-width:500px) { … }
@media (min-width:500px) { … }
如下:
@media (orientation: portrait) { … }
@media all and (orientation: portrait) { … }
没有区别,感觉就像是规范作者的人工制品,留在那里可能是为了让代码更直观。
这两者有什么区别:
@media all and (orientation: portrait){}
@media(orientation:portrait){}
我一直认为默认情况下媒体查询会影响所有媒体,因此没有必要这样做,但最近我经常看到这种情况,我不再确定了。
真的有区别吗?
A shorthand syntax is offered for media queries that apply to all media types; the keyword ‘all’ can be left out (along with the trailing ‘and’). I.e. if the media type is not explicitly given it is ‘all’.
即这些是相同的:
@media all and (min-width:500px) { … }
@media (min-width:500px) { … }
如下:
@media (orientation: portrait) { … }
@media all and (orientation: portrait) { … }
没有区别,感觉就像是规范作者的人工制品,留在那里可能是为了让代码更直观。