Home > Web Front-end > HTML Tutorial > Why is a:visited invalid? _html/css_WEB-ITnose

Why is a:visited invalid? _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:17:36
Original
1487 people have browsed it

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><meta http-equiv="Content-Type" content="text/html;charset=utf-8"><style type="text/css">.link a:link{	color:blue;}.link a:visited{	color:yellow;}.link a:hover{	color:red;}.link a:active{	color:#ccc;}</style></head><body><div id="webmanage">	<ul>		<li class="link"><a href="__ROOT__category" target="dashbord">栏目一</a></li>		<li class="link"><a href="__ROOT__article/lists" target="dashbord">栏目二</a></li>		<li class="link"><a href="__ROOT__article/add" target="dashbord">栏目三</a></li>		<li class="link"><a href="__ROOT__member/reg" target="dashbord">栏目四</a></li>	</ul></div>	</body></html>
Copy after login

Why can't this code be implemented: when the mouse is not clicked, it is blue, when it is clicked, it is yellow, then click the second one, the second one is yellow, and the previous one returns to blue? ? ?

I found that the main problem is 1.visited. Is there a problem here? 2. When you open this page, aren’t they all blue?


Reply to discussion (solution)

.link a:link{    color:blue;}a:visited{    color:yellow;}a:hover{    color:red;}a:active{    color:#ccc;}
Copy after login

Remove the previous .link

Also remove the first one , typo.

You separate this attribute a into different classes, and then set its attributes. For example:





  • css:
    .a a:link{}
    .b a:link{}
    .c a:link{}
    .d a:link{}
    You should get the effect you want

    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template