html - 网页字体应该包含在 head 标签之间吗?

标签 html css

<分区>


想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它.

关闭 7 年前

我想知道是否有关于我应该在何处(在什么地方)包含网络字体的最佳实践。我的意思是使用 <link href...> .看起来我看到的每个网站的 head 标签之间都包含网络字体,但我看到人们这样做的唯一原因是首先下载字体,所以当默认字体更改为下载的。

Web 字体应该/不应该放在 head 标签之间还有其他原因吗?

最佳答案

这是引自Optimize the order of styles and scripts (来自谷歌的 "Make the Web Faster" Best Practices docs )

stylesheets should always be specified in the head of a document for better performance, it's important, where possible, that any external JS files that must be included in the head (such as those that write to the document) follow the stylesheets, to prevent delays in download time.

现代浏览器会等待任何类型的渲染,直到整个 <head>部分被检索(包括其中链接的文件)。所以最好添加 尽可能少地处理此部分。

所以你最好在任何 <script> 之前添加它在<head>文档的一部分。

还有更多的考虑,Yahoo's list of optimizations非常值得您花时间通读。 Google has some good advice

关于html - 网页字体应该包含在 head 标签之间吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35214552/

上一篇:javascript - 如何用可扩展的主div实现垂直滑动显示/隐藏div

下一篇:Jquery - (如果 css = A)做 B

相关文章:

jquery - 切换 div onclick 的不透明度

css - css 中的背景图像属性不起作用

css - 无法在 Spring MVC 应用程序中从 CSS 访问图像文件

javascript - (包括 JSFIDDLE)sweet alert js - 按钮交换(确认按钮在左边,取消按钮在右边)

html - 我无法让 IE8 支持 :before

html - <Span> 不是 block 文本

html - z-index 在两个菜单之间不起作用

html - 列表元素中的 anchor 未用显示 :block and height/width set to 100% 填充可用空间

javascript - 如何使用jquery显示具有许多不同div的所有数据的每2项?

css - 输入类型 "range"的拇指样式在 IE 中不起作用