css - 即只有最小宽度的样式
问题描述
我如何将 ie only 媒体查询与最小宽度媒体查询结合起来(我读到 IE 是唯一不支持嵌套媒体查询的浏览器) - 因为我使用
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {}
所以我想我能做到
@media screen and (min-width: 1024px) and (-ms-high-contrast: active), (-ms-high-contrast: none) {}
但这仍然在下面应用1024px
。如何结合最小宽度和 ie 媒体查询,使其仅适用于 ie 中的 1024px 以上?
(我打算制作一个片段,但它们无论如何都不能在 ie 中工作,所以如果您需要更多信息,请告诉我,但上面的代码足以复制我的问题)
解决方案
您使用了一个逗号,它的作用类似于or
@media screen and (-ms-high-contrast: active),
(-ms-high-contrast: none) {}
所以当媒体查询被触发时
@media screen and (-ms-high-contrast: active)
或者
(-ms-high-contrast: none)
如果要添加另一个条件,则需要添加两次
@media screen and (min-width: 1024px) and (-ms-high-contrast: active),
screen and (min-width: 1024px) and (-ms-high-contrast: none) {}
(不确定您是否还需要检查screen
两次,我在下面的@04FS 评论之后包含了)
推荐阅读
- selenium - Selenium 循环,表格缺少第一行和最后一列
- c# - 如何在 .NET 的控制器中支持作为 formbody 的继承?
- java - 在 NetBens 中使用 addDateEvaluator() 方法后如何启用 JCalendar 按钮?
- flutter - Flutter:我们在哪里可以使用线性渐变而不是容器
- flutter - 使用 Riverpod 时可以保存全局 ref 对象吗
- javascript - 反应路由器 v6 在组件之外导航
- python - Python:局部函数中的全局变量可能吗?
- java - 在 Spring Boot jpa 中存储日期的最佳方法是什么?
- c# - 在 MongoDB 5.0 中过滤基于时间的数据,c# 驱动程序:得到错误(零)结果
- python - 如何通过比较两个对象的函数的结果对对象列表进行分组?