0

I want to use AND condition in media query. I use the the following code, but it didn't works

@media screen and (max-width: 995px AND max-height: 700px) {
}
Yadhu Babu
  • 1,503
  • 2
  • 13
  • 25
  • Possible duplicate of [CSS media queries: max-width OR max-height](http://stackoverflow.com/questions/11404744/css-media-queries-max-width-or-max-height) – Manmeet S. Oberoi Jan 31 '17 at 07:06

3 Answers3

4

It's missing close and open parenthesis before and after the Logical Operator

@media (max-width: 995px) and (max-height: 700px) { ... }
Lex
  • 184
  • 2
  • 10
2

The correct and simpliest way to write this is:

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

}
Kevin Jimenez
  • 436
  • 2
  • 10
0

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

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

From https://developer.mozilla.org/en/CSS/Media_queries/

...In addition, you can combine multiple media queries in a comma-separated list; if any of the media queries in the list is true, the associated style sheet is applied. This is the equivalent of a logical "or" operation.

Awadhesh verma
  • 530
  • 4
  • 10