我认为您不是在寻找AND
运算符,而是OR
在 CSS 世界中只是一个逗号的运算符。因此,您可以执行以下操作:
@media only screen and (max-width: 600px),
screen and (orientation:portrait) {
/* styling goes here */
}
However, in order to achieve the result you wish you would have to invert the order of your queries so that they can cascade correctly. This is because, for example, in the iPad, even in portrait orientation you are going to have a min-width: 600px
, evaluating one of the two statements to true and hence triggering the media query.
By putting the portrait
media query below the landscape
one, you will actually make sure that when the orientation
query evaluates to TRUE
you will be overriding the previous styling.
You can see a modified working version of your JSBin here:
Working example
Try this with the iPad. Though being larger than 600px in portrait mode, it will still display: small-screen.