css @import 外部样式表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2347178/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
css @import external style sheet
提问by Tomba
If it possible to use @import in a .css file to load a style sheet from another site? Specifically, I have a main style sheet for my site which loads in other (local) style sheets using @import. I'd also like to load in a jquery ui theme hosted by google, e.g.
如果可以在 .css 文件中使用 @import 从另一个站点加载样式表?具体来说,我的站点有一个主样式表,它使用@import 加载到其他(本地)样式表中。我还想加载由 google 托管的 jquery ui 主题,例如
@import "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css";
This does not seem to work - I wanted to check whether this is allowed before working out exactly where the problem is.
这似乎不起作用 - 我想在确定问题所在之前检查是否允许这样做。
采纳答案by Pekka
That should work. Are you sure it is not loaded? What browsers does this happen in? Can you confirm using Firebug?
那应该工作。你确定没有加载?什么浏览器会出现这种情况?你能确认使用 Firebug 吗?
There is no mention of it not working in the w3 specsnor in the related MSDN Article(The latter applies to IE only of course).
没有提到它不适用于w3 规范和相关的MSDN 文章(后者当然仅适用于 IE)。
According to those specs, adding url(...)
around the address is optional, but try whether that yields better results.
根据这些规范,url(...)
在地址周围添加是可选的,但请尝试是否会产生更好的结果。