CSS 媒体查询运算符
有人可以用非常简单的术语向我解释一下运算符 and
、not
、only
和逗号 ,
吗? CSS 中的意思和作用?
Can some one explain to me in very simple terms what the operators and
, not
, only
and the comma ,
mean and do in CSS?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这四个运算符实现了集合论逻辑。在这种情况下,以下是每个的含义:
,
:相当于“union”;例如@media screen, print
匹配屏幕或打印设备and
:相当于“交集”;例如@media screen and (min-device-width: 1920px)
匹配分辨率为 1920px 的屏幕设备not
:相当于“设置差异”;例如@media not screen and (color)
匹配非屏幕且支持颜色的设备only
:相当于“适当的超集”;例如,@media only screen and (color)
匹配仅是屏幕且仅支持颜色的设备References
嵌套媒体查询 | Haystack
媒体查询中的逻辑 | CSS-Tricks
媒体查询级别 4:评估媒体查询< /a>
The four operators implement set theory logic. In that context, here is what each one means:
,
: equivalent of 'union'; e.g.@media screen, print
matches a screen or print deviceand
: equivalent of 'intersection'; e.g.@media screen and (min-device-width: 1920px)
matches a screen device with 1920px resolutionnot
: equivalent of 'set difference'; e.g.@media not screen and (color)
matches a device which is not a screen and supports coloronly
: equivalent of a 'proper superset'; e.g.@media only screen and (color)
matches a device which is only a screen and only supports colorReferences
Nesting media queries | The Haystack
Logic in Media Queries | CSS-Tricks
Media Queries Level 4: Evaluating Media Queries