改变链接的属性

Cur*_*arn 0 css css-selectors

我有以下html文字.

<ol class="otherstufflinks">
    <li> 
        <a href="./pythonNotes/index.html">Python notes</a>
    </li>
    <li> 
        <a href="./figure.html">Cool figure made using</a> 
        <a href="http://mbostock.github.com/d3/" class="nestedlink">d3.js library.</a>
    </li>             
</ol>
Run Code Online (Sandbox Code Playgroud)

css文件中的相关部分是:

a:link, a:visited {
    color: steelblue;
    text-decoration: none;
}

a:hover {
    color: rgb(210,135,60);
}

.otherstufflinks > li,
.otherstufflinks a:link, .otherstufflinks a:visited 
{
    font-weight: normal;
    color: rgb(75,75,75);
}

.otherstufflinks a:hover  {
    color: rgb(210,135,60)
}
Run Code Online (Sandbox Code Playgroud)

我想选择一种不同的颜色,比如红色,用于与班级的链接nestedlink.如果有人能告诉我该怎么做,我将不胜感激?我尝试了以下但没有一个工作.

第一次尝试:

.nestedlink a:link, .nestedlink a:visited {
    color: red;
}
Run Code Online (Sandbox Code Playgroud)

第二次尝试:

.otherstufflinks .nestedlink a:link, .otherstufflinks .nestedlink a:visited {
        color: red;
   }
Run Code Online (Sandbox Code Playgroud)

我不知道我哪里出错了.谢谢你的帮助.

小智 5

a.nestedink:link, a.nestedlink:visited {
color: red;
}
Run Code Online (Sandbox Code Playgroud)

我相信只使用.nestedlink,默认的a:link属性会覆盖.nestedlink.