我目前正在使用:
a:link {
color: #FF0000;
text-decoration: underline;
}
但是在我网站的某个页面上,我希望能够使用不同颜色的链接。
通过 CSS 执行此操作的最佳方法是什么?
我不想做:
<font color="#00FF00">...</font>
据我所知,这是已弃用的代码
最佳答案
为您想要影响的每个链接添加一个类:
HTML: <a href="#" class="alternate">Link</a>
然后将此 CSS 或类似内容添加到您的样式表中:
CSS: a.alternate {color:#00FF00;} //or whatever
关于css - 将链接颜色与 :link 分开的简单方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18634762/