Skip navigation.

Poll: Describe Your JobAll recent postsYour Site Through Users' Eyes

Flash of Unstyled Content

Sometimes it's a good idea to hide your CSS rules from older browsers. Why? Because older browsers, version 4.0 of Netscape and Internet Explorer/Win, had flaky support of CSS. You can move basic CSS rules into one external style sheet and <link> it, while advanced CSS rules go into another style sheet which you @import.

For example:

<link rel="stylesheet" type="text/css" media="all" 
                           href="/styles/simple.css" />
<style type="text/css" media="all">
/* <![CDATA[ */
@import "/styles/advanced.css";
/* ]]> */
</style>

The CDATA fudge is there if you serve your markup as XML.

Back to my point. Internet Explorer/Windows has this weird bug—under certain conditions, when you @import a style sheet, your page will display raw, without any styles applied for a second or less and then the styles kick in. An unpleasant visual effect. This behavior is dubbed the Flash of Unstyled Content. This is something I encountered myself a couple of times.

I believe its discovery and invention of a fix belongs to Rob Chandanais. Be sure to read his article, Flash of Unstyled Content (FOUC) to learn how to get rid of this nuisance. The fix is simple, very simple like most ingenious inventions.

Comments

No comments yet

Emails and Notifications

Would you like to be notified when somebody responds to this post? 

TrackBacks

Sorry, TrackBacks are not allowed.

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):