为什么@import不建议链接css? [英] Why @import is not advisable to link css?

查看:169
本文介绍了为什么@import不建议链接css?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 @import 不建议链接css? @import 不能通过< link> 执行,并且@import与任何不兼容浏览器?

Why @import is not advisable to link css? What @import can't do which can be done by <link> and does @import have any incompatibility with browsers?

< Link> 中有什么建议? @import 这是有用的吗?

What in <Link> make it's advisable? And is there any specialty in @import which is useful?

如果我们总是使用< link>

推荐答案

< link> vs @import 不要使用@import ;引用它的一小部分:

Here's a link to an article that talks about performances and <link> vs @import : don’t use @import ; quoting a small portion of it :


使用 LINK 而不是 @import 如果
需要样式表在
中下载,则会导致更快的页面。

use LINK instead of @import if you want stylesheets to download in parallel resulting in a faster page.

这不是旧的(从2009年4月 - 也就是不到一年前),所以它应该仍然是大多数是真的 - 它是由史蒂夫·苏德斯,他的名字

It's not that old (it's from April 2009 -- i.e. less than one year ago), so it should still be mostly true -- and it's written by Steve Souders, whose name is quite well-known when it comes to front-end performances.



在一个更主观的观点,我更喜欢使用几个< link> 从我的主HTML文件:这种方式,我能够看到,只有一眼就能看到css文件被称为 - 看看服务器上的模板文件,或者查看客户端生成的HTML源代码。


On a more subjective point, I quite prefer using several <link> from my main HTML file : this way, I am able to see in only a quick glance what css files are called -- either looking at the template file on the server, or looking at the generated HTML source on the client side.

这篇关于为什么@import不建议链接css?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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