Media query for Motorola e(2nd generation). Kindly post the media query. #media only screen
and (min-width: 480px)
and (max-width: 960px) and (orientation:portrait) is not working
your syntax may be wrong as posible so try this
#media screen and (min-width: 480px) and (max-width: 960px) {
//Your Code
}
Related
Hi guys I was always using a simple media queries scaffold but this time round I'm trying a bit more complex approach. Of course I'm trying to write as much stuff on grid and flexbox, but we all know that websites needs media queries.
So the problem I'm facing is that if I use the below approach I'm forced to set every breaking point in order to achieve the responsive web design.
mobile -> #media (max-width: 767px)
tablet -> #media (min-width: 768px) and (max-width: 1024px)
laptop-small -> #media (min-width: 1025px) and (max-width: 1349px)
laptop -> #media (min-width: 1350px) and (max-width: 1549px)
desktop-small -> #media (min-width: 1550px) and (max-width: 1679px)
desktop -> #media (min-width: 1680px)
Now when I use this method below I was expecting that I can use any of the predefined breaking points and if the breaking point is not set, browser will use any closest one which is set.
But in practice they overlapping each other :(
mobile -> #media (max-width: 767px)
tablet -> #media (max-width: 1024px)
laptop-small -> #media (max-width: 1349px)
laptop -> #media (max-width: 1549px)
desktop-small -> #media (max-width: 1679px)
desktop -> #media (min-width: 1680px)
And the third one is working exactly the same as the second one but other way round, and queries are also overlapping each other.
mobile -> #media (max-width: 767px)
tablet -> #media (min-width: 768px)
laptop-small -> #media (min-width: 1024px)
laptop -> #media (min-width: 1349px)
desktop-small -> #media (min-width: 1549px)
desktop -> #media (min-width: 1680px)
So what I'm doing wrong? The first approach works for me but there is so much hassle to set every element to those breaking points and I think there must be another way. I would like to have a proper media query scaffold and use any breaking point I need so for example first middle one and last one if there is such a need on my design.
I just need some suggestions or hints guys.Thanks!
Edit: 28/05/2022
So, this looks like mobile first approach because all outside or below <768px is designated for mobile.
#media (min-width: 768px)
#media (min-width: 1025px)
#media (min-width: 1350px)
#media (min-width: 1550px)
#media (min-width: 1680px)
#media (min-width: 2000px)
Do I'm right here?
I have like 16 media queries or something and i noticed that if i put every media query portrait 1 different color some are falling under another media query. For instance i have:
#media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {}
and i have for instance:
#media only screen and (min-device-width: 320px) and
(max-device-width: 568px) and (-webkit-min-device-pixel-ratio: 2)
and (orientation: portrait) {}
Then both backgrounds are red but i put the second background on purple. I am referring to my own website www.gester.nl. Can someone help me and see into the website with media query code why some media queries are not working like they are supposed to work. Is it that i use a wrong order or something? I just use google f12 to see how it looks on other devices.
Your media queries are overlapping. You will want to use something like the below to target specific screen sizes:
#media only screen and (min-width: 320px) and (max-width: 480px) {
// do stuff between 320px and 480px
}
#media only screen and (min-width: 481px) and (max-width: 568px) {
// do stuff between 481px and 568px
}
I have two media query combined like below in my scss file:
#media all and (min-width: 600px) and (orientation: portrait),
// add css rule to the above media query
all and (min-width: 601px) and (max-width: 840px) and (orientation : portrait) {
border: 1px solid #red
// add specific css rule to current media query only
}
How would I add a specific rule for each query in that case?
I am afraid you can't do that. This is one query, with two sets of rules, there is no "current" query. You can repeat the rules in new queries like this:
#media all and (min-width: 600px) and (orientation: portrait) {
// styles
}
#media all and (min-width: 600px) and (orientation: portrait),
all and (min-width: 601px) and (max-width: 840px) and (orientation : portrait) {
// shared styles
}
ps: you are missing the class declaration on your example
You can use variables to save queries. Also nest #media to keep them organized because all #media rules won't be nested in CSS. It would be nice to interpolate in #media rules but it is not working yet.
$media: 'all and (min-width: 600px) and (orientation: portrait)';
$media2: 'all and (min-width: 601px) and (max-width: 840px) and (orientation : portrait)';
#media #{$media} {
color:red;
#media #{$media}, #{$media2} {
color:blue;
}
}
I ried to put comma to combine media query but didnt work
#media all and (min-width: 600px) and (orientation: portrait),
#media all and (min-width: 601px) and (max-width: 840px) and (orientation : portrait) {}
any ideas how to do that in scss?
get rid of #media on the second line:
#media all and (min-width: 600px) and (orientation: portrait),
all and (min-width: 601px) and (max-width: 840px) and (orientation : portrait) {}
That has nothing to do with SCSS by the way. It is how you declare media queries in plain css too. Here is some documentation, refer to comma-separated lists - https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries
What is the correct way of using media queries.
Is it method
A.)
#media (max-width: 992px){
something here
}
Or method
B.)
#media (min-width: 442px) and (max-width: 992px)
Both your examples are valid, but they are different.
#media (max-width: 992px){ The screen is narrower than 992px.
#media (min-width: 442px) and (max-width: 992px){ The screen is wider than 442px, and narrower than 992px.