ArJ
ArJ

Reputation: 395

Div background color not showing in IE8

I am starting from the body tag.

<body>
<div align="centre">
<header>

</header>

<section class="wrapper">

</section>

</div>

</body>

This is the basic structure of the page, the main problem is the section class="wrapper" is not loading its body-color which is set to white.

This is the CSS for the wrapper class.

.wrapper {
background: #FFF;
width: 100%;
float: left;
margin: 0;
padding: 0;
}

This is the link : http://codomotive.in/projects/classified/index1%20-%20Copy.html

All of it is working fine in CHROME, MOZILLA, SAFARI, but i have to make it working for IE8. PLS HELP.

Upvotes: 1

Views: 1621

Answers (6)

Paulie_D
Paulie_D

Reputation: 115278

Have you incorporate the HTML5 Shiv to support IE8?

Upvotes: 1

Spudley
Spudley

Reputation: 168755

IE8 does not recognise new HTML5 tags like <header> and <section> as being valid. It will therefore not render them correctly.

You can fix this by using a hack called html5shiv, which forces IE8 to recognise these tags.

Another option is to use Modernizr, which includes the same functionality, plus a bit more for helping you deal with other issues caused by using an old browser.

Upvotes: 0

header and section are HTML5 tags. You need to include html5shiv script (https://code.google.com/p/html5shiv/) to get HTML5 working on IE8

Also centre is illegal value for attribute align. You mean center here.

Besides that, since you are using HTML5 anyway, you should avoid align attribute entirely and use CSS instead.

Upvotes: 0

Joe Fitzsimmons
Joe Fitzsimmons

Reputation: 200

Diodeus is correct, IE8 doesn't know what to do with . To get around this, insert an HTML shim. It's a javascript library that will allow legacy browsers to understand the tag.

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

More info here: https://code.google.com/p/html5shim/

Upvotes: 0

Mag
Mag

Reputation: 715

IE8 and lower need adding some code to support new html5 elements (suach as header, section etc.) :

<script>
document.createElement('header');
document.createElement('section');
document.createElement('article');
document.createElement('aside');
document.createElement('nav');
document.createElement('footer');
</script>

Upvotes: 0

Andr&#233; Dion
Andr&#233; Dion

Reputation: 21718

As stated by Diodeus, IE 8 does not natively support the newer HTML 5 tags (such as <section>).

You can, however, easily add the support using html5shiv. html5shiv will enable support for those elements both in JavaScript (e.g., document.getElementsByTagName('section')) and in CSS.

Upvotes: 0

Related Questions