即只有最小宽度的样式

ie only style with min width

如何将仅 ie 媒体查询与最小宽度媒体查询结合起来(我读到 IE 是唯一不支持嵌套媒体查询的浏览器)- 我使用 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 评论后包含了