jQuery is a good choice to write the CSS code for IE-browsers or not? Many times I am facing with this problem. Sometimes it is so difficult to understand how to rewrite the code for all browsers including IE, sometimes I use jQuery to change the small pieces of code, but there is a problem, if user’s internet bandwidth is weak, jQuery loads the CSS after the page is fully loaded, it is always like this, and the new users can do their bad impression about the site, and so on. Well, any advices to improve this?
Share
jQuery should not be responsible for loading all your CSS. Hopefully this is not what you meant.
However, if you are talking about the flash of ugliness that can appear before all the javascript is done executing, one technique is to write specific CSS for you users without javascript. The idea is basically this:
Then when jQuery loads, immediately call something like this:
Then you can use this selector in CSS to target elements when jQuery is or is not loaded or enabled.
Taken from the HTML5Boilerplate docs (one place this technique is used):
In general though, try to make sure everything looks good without javascript, and use js for enhancements.