本文介绍了CSS媒体查询:max-width OR max-height的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编写CSS媒体查询时,是否有任何方式可以用OR逻辑指定多个条件?

When writing a CSS media query, is there any way you can specify multiple conditions with "OR" logic?

我试图这样做:

/* This doesn't work */
@media screen and (max-width: 995px OR max-height: 700px) {
  ...
}


推荐答案

使用逗号指定两个(或多个)不同的规则:

Use a comma to specify two (or more) different rules:

@media screen and (max-width: 995px) , screen and (max-height: 700px) {
  ...
}

这篇关于CSS媒体查询:max-width OR max-height的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 16:51