Do< link href ="">标签只能进入< head>标签? [英] Do <link href=""> tags only go in the <head> tag?

查看:59
本文介绍了Do< link href ="">标签只能进入< head>标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用< link href> 可以包含< head> code>标签,或者它们是否只在< head> 中使用?



不建议这样做,因为< link> 将开始渲染,然后当样式表加载时,将重新渲染新样式。这意味着页面加载会更慢(因为浏览器必须重做所有的工作)和uglier(因为将有一个样式,然后重新设置看起来不同的内容闪光的内容)。


Is it possible/good practice to use <link href""> to include stylesheets outside of the <head> tag, or do they only work / should they be only used in <head>?

解决方案

It's possible to do it.

It's not recommended to do it, because whatever content comes before the <link> will start rendering and then when the stylesheet is loaded will be rerendered with the new styles. That means that the pageload will be slower (because the browser has to redo all that work) and uglier (because there will be this flash of content with one style that's then restyled to look different).

这篇关于Do&lt; link href =&quot;&quot;&gt;标签只能进入&lt; head&gt;标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆