简体   繁体   中英

Why does the HTML5 boilerplate put modernizer in head tag?

If you look at the current HTML5 Boilerplate from github,
You will see that they include modernizr at the bottom of the head tag,
but other javascript files at the bottom of the body tag.
Why the separation?

From the Modernizr documentation:

Drop the script tags in the (head) of your HTML. For best performance, you should have them follow after your stylesheet references. The reason we recommend placing Modernizr in the head is two-fold: the HTML5 Shiv (that enables HTML5 elements in IE) must execute before the (body), and if you're using any of the CSS classes that Modernizr adds, you'll want to prevent a FOUC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM