li:hover a visited colour

2019-02-28 21:09发布

I within my li element I have a link and some text contained within a span.

When I hover over the li I want to change the colour of the text and link, this works well, however I am struggling to set a visited colour and keep this functionality.

Here is my code -

HTML -

<ul id="progress" class="tour_1">
    <li>
       <span class="number"><a href="http://mylink.com">1</a></span>
       <span class="desc">A Link</span>
    </li>
</ul>

CSS -

#progress li { float: left; width: 20%; text-align:center; font-size: 12px; color: #CCC; z-index: 10 }
#progress li .number { font-size: 24px; font-weight: 400; border: 2px solid #CCC; border-radius: 40px 40px 40px 40px; -moz-border-radius: 40px 40px 40px 40px; width: 30px; height: 30px; display: block; margin: 0 auto; background-color: #FFF }
#progress li:hover, li:hover a:hover { color: #333; }

1条回答
Summer. ? 凉城
2楼-- · 2019-02-28 22:01

You need to set a visited state like:

#progress li:hover a:visited
{
background-color:yellow;
} 

http://www.w3schools.com/cssref/sel_visited.asp

查看更多
登录 后发表回答