I'm lo开发者_运维百科oking to build my first HTML5 site and have been looking at working with IE.
There is html5shiv, Dean Edwards ie7-js and then Modernizr. Are these all largely the same? I'm confused about which route to go.
No, they're not the same at all; they do completely different things.
html5shiv allows you to use the new HTML5 tags in versions of IE that don't understand them. Without it, IE will choke on these tags, so you need this if you intend to use the tags. Don't expect it to make the tags actually do anything in IE though! It just stop the browser complaining about them.
modernizr sets a bunch of classes in your HTML, depending on the available features, which you can use to change your layout according to what the browser supports. It also allows you to use the new HTML5 tags in IE, like html5shiv.
ie7.js (as well as
ie8.js
andie9.js
) uses Javascript to retro-fit some missing functionality to IE.
As far as I'm aware there's no cross-over between them (aside from html5shiv/modernizr), so you can use any combination of them, depending on what features you need to implement.
While I'm on the subject, and since you're asking about tools to make IE more compatible with other browsers, I suggest you also look into CSS3Pie, which will make your life much happier if you plan to use rounded corners on your site (plus one or two other features).
This also has no cross-over with the other three products you mentioned, though they do all aim to make old versions of IE slightly easier to work with.
Easiest way to start a new HTML5 project is using initializr. It will guide and let you build, download your HTML5 project files.
they are somewhat the same, and which way to go is ATM as good a guess either way, and for the record, there's one you missed, http://html5boilerplate.com/ This is sort of a repeat of some years ago when prototype and jQuery were fighting in the same space. I'd personally hazard that jQuery won but for now there's no telling which one of these will win this particular fight. I don't think I could recommend dean edwards ie7-js as it mostly deals with just getting IE7 to act like other more intelligent and likable browsers as opposed to leveraging the whole HTML5 thing as much as the other frameworks.
精彩评论