Responsive media query not working in Google Chrome
add this line in <head> <meta name=”viewport” content=”width=device-width,initial-scale=1″>
add this line in <head> <meta name=”viewport” content=”width=device-width,initial-scale=1″>
I’ve been looking into this too. So far I’ve been impressed with Andy Hume’s approach http://blog.andyhume.net/responsive-containers/ https://github.com/ahume/selector-queries/
Have 2 spans with full and short strings, then when below target resolution, swap between them using a media query: HTML <span class=”full-text”>Saturday</span> <span class=”short-text”>Sat</span> CSS // Hide short text by default (resolution > 1200px) .short-text { display: none; } // When resolution <= 1200px, hide full text and show short text @media (max-width: 1200px) … Read more
The challenges of optimizing for large-scale displays center around how to scale and manage content. You need to assume screen width at certain points. Example: for class “container” @media screen and (min-width: 1400px) { .container { width: 1370px; } } @media screen and (min-width: 1600px) { .container { width: 1570px; } } @media screen and … Read more
In the future please add code you’ve tried. if it’s an image tag you can use a class. Hide the second image on page load and show + hide image 1 at a certain screen size like so: HTML <img src=”image.jpg” class=”image1″/> <img src=”image.jpg” class=”image2″/> CSS .image2{ display: none; } @media only screen and (max-width: … Read more
You should be able to nest @media rules this way in CSS3, but it isn’t yet supported by most browsers. See this answer for details. You would have to fully expand and repeat the top-level media queries for the inner rules for it to work across browsers (and I imagine the SCSS processor would generate … Read more
I’d expect when I’m in resolutions of 600px and above to get a 2.2em h2, but instead I get 1.7em.. In my Dev tools I see that the 2.2em declaration is there, but the other one takes precedence.. It doesn’t make sense! It makes sense. If the media fulfills min-width: 600px, then it should also … Read more
Try this one with retina display /* 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 … Read more
A bit late to the party, but based on the tests below the performance impact seems to be minimal. The test shows the rendering times for an example page with 2000 separate and combined media queries, respectively. http://aaronjensen.github.com/media_query_test/ The main benefit seems to be in file size more than anything else – which, if you’re … Read more
there is no property to specify OS used to view webpage, but you can detect it with javascript, here is some example for detecting Operating system : var OSName=”Unknown OS”; if (navigator.appVersion.indexOf(“Win”)!=-1) OSName=”Windows”; if (navigator.appVersion.indexOf(“Mac”)!=-1) OSName=”MacOS”; if (navigator.appVersion.indexOf(“X11″)!=-1) OSName=”UNIX”; if (navigator.appVersion.indexOf(“Linux”)!=-1) OSName=”Linux”; console.log(‘Your OS: ‘+OSName); got it?, now you can play with document.write to write … Read more