• support@answerspoint.com

CSS media queries: max-width OR max-height

2441

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

I'm attempting to do something like this:

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

 

1Answer


0

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

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

..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.

  • answered 7 years ago
  • Community  wiki

Your Answer

    Facebook Share        
       
  • asked 7 years ago
  • viewed 2441 times
  • active 7 years ago

Best Rated Questions