How to use HTML5 in IE 7?

前端 未结 8 1352
长发绾君心
长发绾君心 2021-02-08 11:24

I was wondering whether there is a way to make html5 code visible in Internet Explorer 7 or less.

For example

8条回答
  •  庸人自扰
    2021-02-08 12:20

    IE versions < 9 will not render elements that they don't recognize, so the new HTML5 elements, header, etc are off the list. Other browsers render unrecognized elements, but without styling.

    The way around this is to "show" the new elements to IE by squirting them into the DOM directly using JavaScript. You only have to do this once on each page view.

    The two standard ways to do this are:

    • The Google Shiv: http://code.google.com/p/html5shiv/
    • Modernizr: http://modernizr.com/

    Modernizr also does a whole bunch of other things to do with feature detection.

提交回复
热议问题