simekadam
simekadam

Reputation: 7384

Style HTML5 in IE without js

please is there a way how to apply styles to html5 elements like header, section, aside etc. in older IEs, but without using javascript? I know that there is the document.createElement(elem); solution, but is that possible even withou scripts?

Upvotes: 0

Views: 285

Answers (4)

Vladi Ivanov
Vladi Ivanov

Reputation: 57

First check, then try to help! 1. You can make your own namespace 2. You can use [if ie] in HTML. If it's IE then use div if it's not then use html5 tag. See on Google for this one. If it's important for you see this article: http://debeterevormgever.nl/en/articles/html5-elements-ie-without-javascript

Upvotes: 0

Jonathan
Jonathan

Reputation: 21

There's a nice fix available that introduces a namespace:

http://debeterevormgever.nl/en/articles/html5-elements-ie-without-javascript

Works well in IE7, IE8.

Upvotes: 2

Erick Petrucelli
Erick Petrucelli

Reputation: 14892

This isn't possible because the default behavior of older Internet Explorer versions is to ignore any not known element. This is why we use the JavaScript approach to "create" elements so that the browser recognizes them.

However, I don't believe that relying on JavaScript is a bad thing, after all there is virtually no user currently with JavaScript off. And if it happens, your site will not be the only one with problems.

Also, you don't need to write all those scripts by yourself. You can rely on something like the HTML5 Boilerplate that does it all for you (and some other things).

However, you can also use approaches to: redirect the user to another page depending on the version of the browser (with server coding), or that use conditional comments to write only known tags on IE.

Upvotes: 2

Ian Devlin
Ian Devlin

Reputation: 18870

To be honest if you're that concerned about supporting users with older versions of Internet Explorer without resorting to JavaScript, then HTML5 isn't for you (in this project anyway) and I'd suggest sticking with HTML 4.01.

Always choose the right tools for the job.

Upvotes: 0

Related Questions