没有媒体类型的@media 规则是做什么的?
What's a @media rule without a media type do?
我继承了这个,想知道没有 "media type" 的媒体查询有什么作用?
@media (min-width: 768px) {
.commentlist-item .commentlist-item {
padding: 0 0 0 2em;
}
}
www.w3schools 的标准语法。com/css/css3_mediaqueries.asp
@media not|only mediatype and (expressions) {
CSS-Code;
}
If the media type is not explicitly given it is all
. ~ W3C Media Queries
换句话说,没有媒体类型的@media 规则是shorthand 语法,其中隐含all
。
更多来自规范:
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
.
EXAMPLE 5
I.e. these are identical:
@media all and (min-width: 500px) { ... }
@media (min-width: 500px) { ... }
As are these:
@media (orientation: portrait) { ... }
@media all and (orientation: portrait) { ... }
...
EXAMPLE 7
I.e. these are equivalent:
@media all { ... }
@media { ... }
我继承了这个,想知道没有 "media type" 的媒体查询有什么作用?
@media (min-width: 768px) {
.commentlist-item .commentlist-item {
padding: 0 0 0 2em;
}
}
www.w3schools 的标准语法。com/css/css3_mediaqueries.asp
@media not|only mediatype and (expressions) {
CSS-Code;
}
If the media type is not explicitly given it is
all
. ~ W3C Media Queries
换句话说,没有媒体类型的@media 规则是shorthand 语法,其中隐含all
。
更多来自规范:
A shorthand syntax is offered for media queries that apply to all media types; the keyword
all
can be left out (along with the trailingand
). I.e. if the media type is not explicitly given it isall
.EXAMPLE 5
I.e. these are identical:
@media all and (min-width: 500px) { ... } @media (min-width: 500px) { ... }
As are these:
@media (orientation: portrait) { ... } @media all and (orientation: portrait) { ... }
...
EXAMPLE 7
I.e. these are equivalent:
@media all { ... } @media { ... }