May be my question sounds stupid but I was wondering if it is possible to make Internet explorer (7 and 8) to recogonize HTML5 tags such as header, footer, section, aside 开发者_JS百科etc, without using javascript ie. with css only?
Thanks
nope, it's not possible, you have to use JS
you could create elements.. e.g
document.createElement("header");
document.createElement("footer");
document.createElement("section");
document.createElement("aside");
or
this link may help How can I use HTML5 in all browsers including IE7,8?
IE8 was released long before the HTML5 spec, so it's not surprising that neither IE7 nor IE8 support any of the HTML5 features.
The only way to make IE8 or earlier recognise and support elements which it doesn't know about is to use a Javascript hack. This hack is available stand-alone in the form of HTML5Shiv, and is also built into the Modernizr feature detection library.
There is no other way to make IE work with HTML5. So the basic answer to your question is "No". Sorry. There is no CSS-only solution. (in fact even the Javascript solution is a hack which exists more by luck than anything else; it certainly isn't something that MS intended to write into IE)
If you don't want to do the Javascript hack, then your best bet is simply not to use the HTML5 tags at all; use <div>
elements instead, with suitably semantic classnames.
Of course, even with this hack, all you're doing is allowing IE to recognise that the new tags are valid HTML; you aren't actually adding any features to IE, so using any of the HTML5 stuff that provides new functionality (such as Canvas or the new input types) is still not going to work. There are separate Javascript tools for a number of these features, but beware of performance issues if you try to do to much (IE7/8 aren't exactly quick at the best of times).
it's possible http://debeterevormgever.nl/en/articles/html5-elements-ie-without-javascript
but it will not validate
html
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:html5="http://www.w3.org/1999/xhtml">
<body>
<html5:section>...</html5:section>
</body>
</html>
css
html5\:section, #element-id, .element-class {
...
}
No, it isn't possible. That is why the JS shim is used.
精彩评论