December 14, 201312 yr Good evening, I am tweaking my responsive website with some media queries. I am trying to capture pages that are 613px or less and have used the following code:- @media screen and (max-width: 613px) { #header-wrap {position:fixed; top:0; left:0; width:100%; z-index:9999; background-color:#0F9; background-repeat:repeat-x;} #header{height:75px;} #menu-wrap{height:50px; padding-top:23px;} #telephone{height:30px; background-color:#06F; text-align:right; padding-top:20px;} #logo{height:75px; padding-top:20px; ;} } However it doesn't seem to pick up the media query until 486px.... I am a bit confused, am I missing something?
December 15, 201312 yr /* Smartphones (portrait and landscape) ----------- */ @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { /* Styles */ } /* Smartphones (landscape) ----------- */ @media only screen and (min-width : 321px) { /* Styles */ } /* Smartphones (portrait) ----------- */ @media only screen and (max-width : 320px) { /* Styles */ } /* iPads (portrait and landscape) ----------- */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) { /* Styles */ } /* iPads (landscape) ----------- */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) { /* Styles */ } /* iPads (portrait) ----------- */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) { /* Styles */ } /* Desktops and laptops ----------- */ @media only screen and (min-width : 1224px) { /* Styles */ } /* Large screens ----------- */ @media only screen and (min-width : 1824px) { /* Styles */ } /* iPhone 4 ----------- */ @media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) { /* Styles */ }
December 15, 201312 yr Author Thanks for your post, it doesn't solve my problem though Edited December 15, 201312 yr by Charly
December 16, 201312 yr Thanks for your post, it doesn't solve my problem though try using media only screen instead of media screen and write max-device width @media only screen and (max-device-width: 613px) { #header-wrap {position:fixed; top:0; left:0; width:100%; z-index:9999; background-color:#0F9; background-repeat:repeat-x;} #header{height:75px;} #menu-wrap{height:50px; padding-top:23px;} #telephone{height:30px; background-color:#06F; text-align:right; padding-top:20px;} #logo{height:75px; padding-top:20px; ;} } also make sure u have <meta name="viewport" content="width=device-width, initial-scale=1.0"> within ur <head></head>
December 16, 201312 yr Hey Charly, If you would like me to take a quick look you could send me a link to your site As it stands though I'm guessing that changing - @media screen and (max-width: 613px) { to @media (max-width: 613px) { would solve your problem unless you have a reason to only target a specific screen type
Create an account or sign in to comment