1

我创建了一个所有列表项作为超链接。
我在这里想要的是项目符号颜色应该与超链接的颜色匹配,具体取决于其状态(已访问或未访问)。
我只想使用 CSS。这可能吗?如果我还可以在将光标悬停在链接上时匹配颜色,那就太好了。

4

2 回答 2

1

Try this

li {
    color:red
}
a {
    color:red;
    display:block
}
li:hover, a:hover{
    color:green
}

DEMO

于 2013-03-21T12:02:48.987 回答
0

You can remove the standard bullet :

ul {
    list-style: none;
}

and re-create it in the a

a::before {
    content: "\2022";
}

now the style of the a includes the bullet

a:visited {
    color: red;
}

non desired effect: the bullet is underlined as it is now part of the a.

I think that could be overdone with more work, anyway.

demo in jsfiddle

于 2013-03-21T17:21:34.187 回答