我继承了这一点,想知道没有“媒体类型”的媒体查询有什么作用?
@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 规则是简写语法,其中隐含了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 { ... }
关于css - 没有媒体类型的@media 规则是做什么的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40450228/