I am trying to change CSS on my page based on the min-height and min-width of the browser, so I am using this:
@media (min-height: 500px), (min-width: 580px) {
/* CSS stuff */
}
But for some reason, this doesn't work. I can check for min-height and max-width (or vice versa) or for max-height and max-width at the same time, but checking for both min values doesn't seem to work.
I should specify this more: I want the browser to act if a min-height or a min-width becomes true. Using the and-operator will only work if both criteria are true.
Am I doing something wrong?
The height media query's value is usually the width media query value divided by the screen's aspect ratio. The height media query is always equal to document. documentElement. clientHeight.
Use a comma to specify two (or more) different rules: @media screen and (max-width: 995px), screen and (max-height: 700px) { ... } Commas are used to combine multiple media queries into a single rule. Each query in a comma-separated list is treated separately from the others.
“max-width and max-height media query” Code Answer's @media only screen and (max-width: 600px) {...} @media only screen and (min-width: 600px) {...} @media only screen and (max-width: 600px) and (min-width: 400px) {...}
If you set the min-height to something lower, such as 720px, it ought to work. Show activity on this post. //simple max-width query @media screen and ( min-height: 600px ){ background: blue; .... } This might help you.
Use and
instead of a comma, like this:
@media (min-height: 500px) and (min-width: 580px) {
/* CSS stuff */
}
Have you added following meta tag in :
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Here is REf : http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/quick-tip-dont-forget-the-viewport-meta-tag/
After that use your media Query :
@media (min-height: 500px) and (min-width: 580px) {
/* CSS stuff */
}
For media query details you can more info from http://stephen.io/mediaqueries/ for all iOS devices. If you have any other query let me know. Even you can get better idea from here http://webdesignerwall.com/tutorials/responsive-design-in-3-steps
Use media query one inside other:
@media screen and (min-height: 40px) {
@media screen and (min-width: 50px) {
/*enter css here to apply for both condition*/
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With