当用户单击它们时,我正在显示在数据库中标记为已读的链接。我想根据数据库信息而不是用户的浏览器历史记录来设置单击和未单击链接的样式。到目前为止,当我使用:
10 a:visited {
11 color: #444;
12 }
13
14 a:link {
15 font-weight: bold;
16 color:black;
17 }
18
19 .read {
20 color: #444!important;
21 }
22
23 .unread {
24 font-weight: bold!important;
25 color:black!important;
26 }
和
<tr class="even">
<td><a class="read" href="example.com">blah</a></td>
</tr>
<tr class="odd">
<td><a class="unread" href="example.org">foo</a></td>
</tr>
并且已经访问了一个链接,但不是来自这个页面(它在数据库中仍然被标记为未读),我得到了奇怪的结果。例如,只有颜色会起作用,但重量不会,等等。
当它们发生冲突时,是否可以让一种风格覆盖另一种风格?
谢谢!
编辑:更新代码以澄清
解决方案
10 a:link,
11 a:visited {
12 font-weight: bold;
13 color: black;
14 }
15
16 a.read {
17 color: #444;
18 font-weight: lighter !important; /* omission or even "normal" didn't work here. */
19 }
20
21 a.unread {
22 font-weight: bold !important;
23 color: black !important;
24 }