Olical
Olical

Reputation: 41362

Background colour not working in IE

Hey, I have noticed that when using Internet Explorer my websites background completely disappears, I am not doing anything different to what I useually do so does anyone have any ides of what could be going on? I think it may have something to do with either the use of HTML5 elements or the Blueprint CSS framework. The site can be found here. In all other browsers it looks fine.

Thanks for any help you can provide.

Upvotes: 1

Views: 3323

Answers (2)

Kyle
Kyle

Reputation: 67194

IE <9 doesn't support HTML5 so your page will be rendered differently in IE<9 but here's a fix for you :)

HTML5 enabling script

Upvotes: 3

Fenton
Fenton

Reputation: 250922

You need to use a HTML5 shim to help IE (and a few others) recognise the elements. You'll also need to tell the browser that they are block level elements by default.

Here is the result of my browser test:

You can grab my JavaScript file here (by creating the elements in script, the browser then accepts any elements with the same tag) - it is already minified and needs to be in the HEAD of your document (in case you normally put them at the bottom of your document):

And you will need to add this CSS to the top of your style sheet:

article, aside, figure, footer, header, hgroup, nav, section {
    display: block;
}

I've tested the fix on tons of browsers as you can see in the test and have been running my website using this fix for ages!

Upvotes: 2

Related Questions