I'm using a custom build of Modernizr that includes html5shiv v3.7

In my markup I have classes applied to HTML5 elements like so:

<article class="white_text">This text is white</article>

and the CSS would be something like:

.white_text { color: white; }

This works as expected in all browsers that I need to test, but the attributes of the class "white_text" are not applied in IE8. I can confirm that html5shiv is working properly since

article { DISPLAY: block }

appears in the of the document in IE8.

In order to apply styling to HTML5 elements in IE8, I need to rewrite the markup to surround the elements with non-semantic tags such as .

Is there a problem with how I'm implementing Modernizr?

SOLUTION (thanks to Pinal): The Modernizr script must be placed in the head of the document.

有帮助吗?

解决方案

html5shiv must be on the top of head, before all scripts and stylesheets.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top