是否可以在另一个包含一个CSS文件? [英] Is it possible to include one CSS file in another?
本文介绍了是否可以在另一个包含一个CSS文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在另一个中包含一个CSS文件?
解决方案
是:
@import url(base.css);
注意:
-
@import
规则必须先于所有其他规则(@charset
规则除外);和 - 其他
@import
语句需要其他服务器请求。
将CSS聚合到一个文件中,以避免多个HTTP请求。也就是说,将 base.css
和 special.css
的内容复制到 base-special .css
并仅引用 base-special.css
)。
<并非所有浏览器都支持
@import
(请参阅浏览器兼容性)。 Is it possible to include one CSS file in another?
解决方案
Yes:
@import url("base.css");
Note:
- The
@import
rule must precede all other rules (except the@charset
rule); and - Additional
@import
statements require additional server requests.
Aggregate CSS into one file to avoid multiple HTTP requests. That is, copy the contents of base.css
and special.css
into base-special.css
and reference only base-special.css
).
In 2008, not all browsers supported @import
(see Browser Compatibility).
这篇关于是否可以在另一个包含一个CSS文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文