gpt4 book ai didi

javascript - 为什么 HTML5 样板文件将 modernizer 放在 head 标签中?

转载 作者:行者123 更新时间:2023-11-28 04:23:11 25 4
gpt4 key购买 nike

如果您查看当前的 HTML5 Boilerplate来自 github,
你会看到它们在 head 标签的底部包含了 modernizr,
但是 body 标签底部的其他 javascript 文件。
为什么要分开?

最佳答案

来自 Modernizr 文档:

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.

关于javascript - 为什么 HTML5 样板文件将 modernizer 放在 head 标签中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13105085/

25 4 0