css @import外部样式表 [英] css @import external style sheet

查看:134
本文介绍了css @import外部样式表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果可以在.css文件中使用@import从另一个网站加载样式表?具体来说,我有一个主样式表为我的网站加载在其他(本地)样式表使用@import。我还想加载一个由google托管的jquery ui主题,例如

  @importhttp:// ajax。 googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css; 

这似乎不工作 - 我想检查是否允许,问题是。

解决方案

这应该工作。您确定它未加载吗?这发生在什么浏览器?您可以使用Firebug确认吗?



没有提及它在 w3 specs 以及相关的 MSDN文章 (后者仅适用于IE当然)。



根据这些规范,在地址周围添加 url(...)是可选的,但要尝试是否产生更好的结果。 p>

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.

@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.

解决方案

That should work. Are you sure it is not loaded? What browsers does this happen in? Can you confirm using Firebug?

There is no mention of it not working in the w3 specs nor in the related MSDN Article (The latter applies to IE only of course).

According to those specs, adding url(...) around the address is optional, but try whether that yields better results.

这篇关于css @import外部样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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