一个CSS文件可以优先于另一个CSS文件吗? [英] Can one CSS file take priority over another CSS file?

查看:156
本文介绍了一个CSS文件可以优先于另一个CSS文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在伦敦工作的应用程序,和html / css的家伙在纽约。他每天通过电子邮件发送更新,因为我们没有源控件设置,我们都可以使用,我不断对他的CSS进行小的更改,所以每当我从他的新文件,我必须重新应用我所有的更改显然,我所做的工作越多,每次花费的时间越长。

I'm in London working on an application, and the html/css guy is in New York. He's sending me updates daily by email as we have no source control set up that we can both use, I'm constantly making small changes to his css, so each time I get a new file from him, I have to reapply all my changes to it, and obviously the more work I do, the longer this takes each time.

我有一个想法,即制作自己的独立样式表,但有一种方法告诉浏览器给我的sylesheet更高的优先级,并覆盖任何他的样式,具有相同的类名和属性?

I had the idea of making my own seperate stylesheet, but is there a way to tell the browser to give my sylesheet higher priority and overwrite any of his styles that have the same class name and attributes?

这不会是一个公共网站我们只会支持最新的浏览器。

This isn't going to be a public site so we're only going to be supporting the latest browsers.

推荐答案

这取决于你如何设置他们在你的标题。所以这样的东西会工作:

It depends on how you set them in your header. So something like this will work:

<link rel="old stylesheet" href="path/to/style.css" />
<link rel="newer stylesheet" href="path/to/style.css" />
<link rel="newest stylesheet" href="path/to/style.css" />

最后一个将被选中。

有关样式表的实用链接:
http:// www.w3.org/TR/html401/present/styles.html#h-14.3.2

And an helpful link about stylesheets here: http://www.w3.org/TR/html401/present/styles.html#h-14.3.2

另请参阅:在CSS中优先如果上述情况不适用于您。

See also: Precedence in CSS if the above doesn't work for you.

希望很清楚。

这篇关于一个CSS文件可以优先于另一个CSS文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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