Two #media variables, issue - css

I have two #media variables in my css thats cause a problem.
One is with smaller width #media only screen and (min-width: 1290px).
And the second one is with greater width #media only screen and (min-width: 1610px), allowing me to display more content.
Now, with my browser window in full screen, and a monitor resolution of 1680 x 1050 pixels, I still cannot get #media only screen and (min-width: 1610px) to appear.
Am I missing something?
Thanks.

Try setting the max-width also for your first condition, as currently both your "min-widths" will be hit when the resolution is > 1610px.
#media only screen and (max-width: 1609px) and (min-width: 1290px){
}

Related

Problem with responsive design using #media only screen

I have a problem with understanding how #media only screen works. I have three screen sizes:
1) #media only screen and (max-width: 640px)
2) #media only screen and (min-width: 640px) and (max-width: 1250px)
3) #media only screen and (min-width: 1250px)
I want to make that one element would be shown only on large screen size (3), so I wrote:
display: none on 1) and 2) screens and display: block on 3) screen.
I also have three style files for each screen size which are put into the main file like this:
#import "large-screen";
#import "medium-screen";
#import "small-screen";
And the small-screen size file overwrites the others:
I don't understand how it can overwrite if it's set to #media only screen and (max-width: 640px), doesn't max-width 640px mean that this code will work when screen is smaller than 640px? Can someone explain me how this work and how I should write that my element would be displayed only on large screen. Thank you!

How do i hook media queries to screen resolution?

I been using queries now for a while and grabbed some pre loaded widths etc depending on what type it will be (Phone, laptop, tablet or even normal screen) and i realized its been using min width and max width and nothing to do with height? So i changed it to max width, max height and now it seems to be conflicting with different screens. So i switched it back to min-width and max width but same issue.
I am completely confused as to how these are meant to be used.. I looked through loads of tutorials and all sorts but i still dont understand correctly. Can someone help me out?
Below is two queries that i put together that conflicts and the reason why i am guessing is due to the max-width being the same?
I changed one to just max-height and still doesnt work so i honestly dont know.
The screen sizes i want to create media queries for is the following:
1280 x 768 and is landscape. I also want to do: 1280 x 720
Media query for screen 1280 x 768:
#media only screen
and (min-width: 768px)
and (max-width: 1280px)
and (orientation: landscape)
{
/*css here*/
}
Code for screen 1280 x 720:
#media only screen
and (min-width: 720px)
and (max-width: 1280px)
and (orientation: landscape)
{
/*css here*/
}
What did i try?
I tried doing the following which failed:
#media only screen
and (max-height: 720px)
and (orientation: landscape)
{
/*Screen 1280 x 720*/
}
#media only screen
and (max-width: 1280px)
and (orientation: landscape)
{
/*Screen 1280 x 768*/
}
What am i doing wrong? I tried matching height by width so max-width: 1280 and max-height: 768 lets say and same for the other res but also no look.. It seems like the screen "1280 x 768" picks up the css for the screen "1280 x 720"
All helps appreciated! Thanks.
Your first rule is contradicting your second rule.
1280px x 768 is the same as w x h. So the height would be 768, not the min-width - but this isn't necessary.
#media only screen
and (min-height: 720px)
and (max-width: 1280px)
and (orientation: landscape)
{
/*css here*/
}
(you could use max-height here)
#media only screen
and (min-height: 768px)
and (max-width: 1280px)
and (orientation: landscape)
{
/*css here*/
}
Some strange reason it was picking up both queries so i just made it work for both by making whatever smaller to fit both no matter what the size was.
Example:
background-color: red;
height: 500px; // I want this for one red and 1200 for another lets say
If i make height 1200 it blows it out of proportion but anyway all i did was lets say, leave it as 300px height and was grand. (Not the best, but ok).
If anyone does have a solution then please do let me know as so far this is the only way and is not the best (obviously) solution due to the fact of using only one media query.

FIX #media Queries / #media code for each individual screen size

Website issue to fix:
I’m trying to figure out why some of my #media queries are overlapping. If you look at my code you can see the #media queries are labeled for each device dimension.
#media SCREEN SIZE: MASSIVE
#media SCREEN SIZE: LARGE
#media SCREEN SIZE: MEDIUM
#media SCREEN SIZE: IPAD
#media SCREEN SIZE: SMALL TABLET
The goal is to be able to change font sizes and image sizes for each unique #media / SCREEN SIZE.
Problem: For some reason when I make changes to the image sizes or text sizes on “SCREEN SIZE: MEDIUM” it also apply’s the changes to all the other #media larger screen sizes.
However, I am able to individually change the header background “#header {background:url(../img/super” for each individual #media code just fine without it erroneously changing the background on all the #media / SCREEN SIZE’s.
How can I get the css #media codes to be completely unique to it’s own #media / SCREEN SIZE without affecting the other #media / SCREEN SIZE’s?
And how can I add the final #media for the small phone size (Website currently shows all messed up on a small phone size)?
Let me know the answer. Your all the best!
If you need non-overlapping breakpoints you will have to do something like this
/*Small*/
#media (max-width: 499px) { ... }
/*Medium*/
#media (min-width: 500px) and (max-width: 999px) { ... }
/*Big*/
#media (min-width: 1000px) and (max-width: 1499px) { ... }
/*Large*/
#media (min-width: 1500px) { ... }

CSS Media Query is affecting other queries also

Below are the media queries i have figured out and i will use as default for every project that i will do.
#media only screen and (min-width : 320px) {}
#media only screen and (min-width : 480px) {}
#media only screen and (min-width : 768px) {}
#media only screen and (min-width : 992px) {}
#media only screen and (min-width : 1200px) {}
Now, the problem i am facing with them is that when i try to change something on 768 it gets changed on 320 also. I want to change for example logo if i hide it on 768 it should only be invisible on 768 only, whereas in this case i have to manually go on each and every query and make it visible.
I have tried min-width also and max-width also.
And min-width for mobile size and max-width for big sizes but with no luck.
And if i use fixed queries then also i have to write code for every query.
So, how do i make it work only for single size and does not affect the others, and most importantly not to write code for every size.
#media screen and (min-width: 480px) and (max-width: 767px) {
// applied only between 767 px and 480px
}
It will, To avoid that you need to write specific for all the resolutions below to that. For example: If you are hiding logo in 768 then it affects 480, 320,. To get rid of that you need to write in 480, that the specific logo to be visible, so that it will be reflected in 320 too.
/* #### CSS that's applied when the viewing area's width is 768px or less #### */
#media screen and (max-width: 768px){
div#logo{
display: none;
}
}
For logo to be visible in 480 and 320 try like this:
#media screen and (max-width: 480){
div#logo{
display: none;
}
}
For more info, Reference link

1140 CSS Grid not working on ipad

I have used 1140px CSS Grid (cssgrid.net) to code this page: http://workaday.org/dev/static/
It's restructuring all content on 750px width instead of 767px, as a result it's not working on iPad.
Can someone please suggest what i have done wrong in this?
Update:
I changed max-width to 784px, and now it's working on 767px, there is a difference of 17px. But i am not able to find reason for this so far.
You have
#media handheld, only screen and (max-width: 767px)
That is not logic to me. so you can try with variations
#media only handheld and (max-width: 767px)
or
#media handheld and (max-width: 767px)
I don't have iPad, so I can't test it.

Resources