Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a website that tries to make sensible use of media queries and avoid 'expensive' CSS for users of mobile devices. My eventual goal is to make it 'mobile-first' but for now, since it is based on Twitter Bootstrap it isn't.

I included some background images (Base64 encoded) and styles that would only apply to "full-size" browsers in a separate stylesheet loaded asynchronously via modernizr.load.

In Firefox (but not webkit browsers) it makes it so that if you navigate away from the homepage and then return, the content (specifically, all those extras) 'blinks' when it finishes loading...or maybe I should say reloading.

If, instead of using modernizr.load, I include that stylesheet via a link... in the head with a media query attribute will it prevent the data from being downloaded by non-matching browsers (mobile, based on screensize) that it is inapplicable to?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

YOu are doing it correctly with the MediaQueries. You might want to use modernizer as fallback, and find a polyfill to add media query support to legacy browsers. One thing I would advise you on is not to break up your stylesheet into multiple files. (Mobile.css / 920.css / tablet.css). Its best just to have one big css file, and then the css media rules at the bottom. Look at twitter-responsive.css to get an idea of what i mean.

Also look at BootStrapCDN.com They combine bootstrap.css / bootstrap-responsive.css into one single download. This speeds things up. You should use BootrapCDN.com to serve twitter bootstrap. NetDNA is super fast, and reliable. It will save you some bandwidth fees too.

Then add your own Custom.css after bootstrap which includes your own customizations that override bootstrap.css. Here include all your customizations for responsive layouts.

share|improve this answer
    
github.com/scottjehl/Respond - Media Queries for browsers that dont support them yet. –  Frank Nov 13 '12 at 9:21
    
Thanks, I started out by combining the stylesheets into one but with Base64 Encoded images it was big. I'm trying a middle-of the road approach (my CSS is at this point is merely based on Bootstrap so using a pre-packaged CDN won't help--although I do use NetDNA for the .js). There are a few things which recur sitewide (like my font-icons) so I am using consistent URLs with long-expiration headers as suggested in HTML5 Boilerplate. –  adam-asdf Nov 13 '12 at 10:51

Reset your browser then check properties. clear cache and cookies.

share|improve this answer
    
I did all that before posting the question. When testing I used an emulator so it may not have been totally accurate but the emulator downloaded every file, regardless of conditional comments so I abandoned that approach. –  adam-asdf Apr 4 '13 at 10:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.