什么是没有媒体类型的@media规则? [英] What's a @media rule without a media type do?
问题描述
我继承了这个,并且想知道没有媒体类型的媒体查询是什么?
@media -width:768px){
.commentlist-item .commentlist-item {
padding:0 0 0 2em;
}
}
标准语法每www.w3schools.com/css/ css3_mediaqueries.asp
@media not | only mediatype和(表达式){
CSS-Code;
}
>如果媒体类型没有明确给出,它是all
。 〜 W3C媒体查询
换句话说,没有媒体类型的@media规则是速记语法,其中 all
更多规格:
提供适用于所有
。
媒体类型的媒体查询的简写语法;可以省略关键字all
(以及
结尾和
)。也就是说如果媒体类型没有明确给出,它是
all
示例5
这些都是相同的:
@media all和(min-width:500px){...}
@media (min-width:500px){...}
b
$ b@media(orientation:portrait){...}
@media all和(orientation:portrait){...}
...
p>
这些是等效的:
@media all {...}
@media {...}
source: https://www.w3.org/TR/css3-mediaqueries/#media0
I inherited this and was wondering what does a media query without a "media type" do?
@media (min-width: 768px) {
.commentlist-item .commentlist-item {
padding: 0 0 0 2em;
}
}
Standard syntax per 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
In other words, an @media rule without a media type is shorthand syntax, where all
is implied.
More from the spec:
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 { ... }
这篇关于什么是没有媒体类型的@media规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!