简体   繁体   English

仅更改CSS中的默认链接颜色

[英]Change only the default links color in CSS


I am trying to make some small adjustments to a very big website (not did by me). 我正在尝试对一个非常大的网站进行一些小的调整(不是我做的)。 The main colors of the site are red and black. 该站点的主要颜色是红色和黑色。
Now there are many css classes to define the appareance of the links, however some links are still with the default blue color (without classes applied). 现在,有许多CSS类可以定义链接的外观,但是某些链接仍具有默认的蓝色(未应用任何类)。
I have tried adding this to the main css file: 我尝试将其添加到主CSS文件中:

a:link {
    color: #900;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    text-decoration: underline;
}
a:hover {
    color: #000;
}

but this change the appareance of the links with the right colors too. 但这也会以正确的颜色更改链接的外观。 For instance: below, in the same css file there are these classes: 例如:下面,在相同的css文件中,有以下类:

.linkCat {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #000;
    text-decoration: none;
}
.linkCat:hover {
    color: #900;
    text-decoration: underline;
}

My changes will override the behaviour of these classes too. 我的更改也将覆盖这些类的行为。

I would like to know if there is some way to change the style only to the links without style already applied. 我想知道是否有某种方法可以仅将样式更改为未应用样式的链接。

I repeat: the website is really big, i don't like to modify every single page to add a class to the links. 我再说一遍:该网站确实很大,我不喜欢修改每个页面来为链接添加类。

Thank you. 谢谢。

put the following at the top of the css file 将以下内容放在css文件的顶部

a {
    color: #900;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    text-decoration: underline;
}
a:hover {
    color: #000;
}

If that does not help, use a web inspector to see what overrides the problematic styles. 如果那没有帮助,请使用Web检查器查看哪些内容覆盖有问题的样式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM