have a bandit day

Icon

Deliberate, thoughtful design is not easy. I strive to create works that are professional, whether it’s by complying with precise standards or providing the quality clients expect. My style? Throw in two parts minimalist, one part flair, a handful of humor and a dash of cowboy. Blend until smooth.

“Back the FOUC up”

The division of presentation and structure is what makes the XHTML/CSS combo so delightful. XHTML logically divides your content while CSS appropriately applies the style. Two peas in a pod, really.

When creating a website, I’ve encountered the FOUC bug. This vulgar sounding bug stands for Flash Of Unstyled Content. When visiting a webpage for the first time, before the stylesheet is cached locally, you’ll get a flash of the page contents without any styles applied. Kinda like someone walking in on you in the shower when you’re hair is shampoo’d into a mowhawk and you’re belting out the lyrics to Britney Spear’s smash hit, Womanizer. It’s a bit awkward seeing something you weren’t supposed to.

Problem: The cause of the bug has been traced to using the “@import” rule in your header section used to call in the stylesheet.

Instead of:

</head>
<title>My Page</title>
<style type=”text/css”>
@import “style.css”;
</style>
</head>

Use:

<head>
<title>My Page</title>
<link rel=”stylesheet” type=”text/css” media=”print” href=”print.css”>
<style type=”text/css”>
@import “style.css”;
</style>
</head>

According to Rob @ Bluerobot.com, the above method solves the problem. With an addition of a link in the header section, the FOUC bug disappears. In the example above, the link doesn’t actually link to anything. Since it’s there, why not link to a media dependent stylesheet, say for print or handheld devices? A blank link is a terrible thing to waste.

- bang.

Category: Web Development

Tagged: , , , ,

Leave a Reply

Salutations

Welcome to my blog. Make yourself at home.


What started out as a purely web developer / SEO-centric blog has slowly degraded into the odd kitchen drawer of fancies. Now where did i put that sewing kit...

Twitter: ianderthal

flickr link delicious link linkedin link facebook link facebook link