0

This is my media query for resolution with width of 1280 pixels:

@media (min-width: 1270px) and (max-width: 1280px)

When I want to use seperate query for height like this:

@media (min-width: 1270px) and (max-height: 960px)

It doesn't work. It's not showing even in the developer tools in chrome. Can I get some suggestions?

jeerbl
  • 6,582
  • 5
  • 22
  • 36
zlotte
  • 1,247
  • 5
  • 22
  • 35

2 Answers2

0

you need to add a comma between different conditions (width/height)

@media screen and (min-width: 1270px), screen and (max-height: 960px )

https://jsfiddle.net/ahmadabdul3/fxaknLn7/

duxfox--
  • 9,097
  • 15
  • 55
  • 116
  • It would be good now, but now it's shows that at first uses `@media (max-width: 1280px) and (min-width: 1270px)` and just then the one with `height` – zlotte Feb 11 '16 at 21:42
  • there's another problem then. are you referencing multiple css files? do they have different media queries? check all these things. did you try clearing your browser's cache? refresh page after. etc – duxfox-- Feb 11 '16 at 21:44
  • I'm using only one .css It just shows this: `@media (min-width: 1270px) and (max-width: 1280px )` and then `@media (min-width: 1270px) and (max-height: 960px )` this – zlotte Feb 11 '16 at 21:45
  • did you clear your browser cache? go to settings -> history -> clear all browsing data – duxfox-- Feb 11 '16 at 21:47
  • Yes. I think I have a problem with res. There were before the same things happened and I manage to fixed them, probably I should try another options – zlotte Feb 11 '16 at 21:49
-1

You must add this code at first

<meta name="viewport" content="width=device-width" />

and use this link

https://css-tricks.com/logic-in-media-queries/

@media screen and (max-width: 995px) , screen and (max-height: 700px) {
  ...
}
nyn05
  • 534
  • 5
  • 17