This is driving me insane! I've looked at a few questions on Stackoverflow and see that an ID element has priority over a class element (which is good to know but I have a feeling this isn't my problem). It's my NAVIGATION menu that I'm struggling with. (I use max-width btw)
Here is the GENERAL CSS for my NAV:
nav{ float:right; margin-left:2%;}
nav ul{ float:left; list-style:none; width:100%;}
nav ul li{ float:left; margin-left:5px; }
nav a{ display:inline-block; float:left; color:#f0f0f0; text-transform:uppercase;
font-family:TrumpGothicWestRegular; font-size:1.5em; padding: 100px 20px 20px 20px; }
Now when the Viewport is UNDER 1140px, I want the CSS to change the menu like so:
nav ul li{ float:left;}
nav a{ float:left; display:inline-block; padding: 20px 20px 20px 20px;}
So basically the menu will float left with less top padding.
When the Viewport is UNDER 800px, I want the CSS to change the menu like so:
nav ul li{ float:none;}
nav a{ float:none; padding: 20px 20px 20px 20px;}
As you can see I've I only changed the NAV Float to NONE
Now when I test it, the GENERAL CSS works fine as well as when the view port under 1140px, but as soon as I go under 800px, the NAV still floats to the left!!?? It seems to be inheriting the CSS media query of 1140px? Any ideas?
UPDATE: This is how I am defining my media queries
<link rel="stylesheet" media="only screen and (max-width: 800px), only screen and
(max-device-width: 800px)" href="small-device800.css" />
<link rel="stylesheet" media="only screen and (max-width: 1140px), only screen and
(max-device-width: 1140px)" href="small-device1140.css" />
!important
to yourfloat:none
rule; try to inspect the element's active styles and overrides in chrome developer tools or equivalent tools in your browser of choice. Also, you haven't described your actual media queries in question. – Moreira<link>
tags you load your css with, or in@include
rules in the css files. You only hint that you usemax-width
, but the actual queries you use are missing in your question. Still, I believe it's more likely that other rules with higher specificity are overriding yourfloat
rule. – Moreira