CSS link styles
CSS link style:
a :link (not visited)
#a:hover
a:visited (visited: actually reached that page)
a:active (between mouse click and release) (interval, has no effect on a objects without href attributes)
These elements have different order when defining CSS, which will directly lead to different link display effects. Specificity is sorted from general to special: link--visited--hover--activeThe desired effect can be achieved as follows:a:link {color: blue}
a:visited{color: red}
##a:hover{color: yellow}a:active{color: white}
If defined like this:
a:hover{color: yellow}
a:link{color: blue}
a:visited{color: red}
a:active{color: white}
You can’t see hover It works, because :link is the most general effect and its scope is greater than hover, so the previous sentence is covered.
Example:<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>链接样式</title>
<style>
a:link {background-color:#B2FF99;} /* unvisited link */
a:visited {background-color:#FFFF85;} /* visited link */
a:hover {background-color:#FF704D;} /* mouse over link */
a:active {background-color:#FF704D;} /* selected link */
</style>
</head>
<body>
<p><b><a href="/css/" target="_blank">这是一个 link</a></b></p>
<p><b>注意:</b> hover必须在:link和 a:visited之后定义才有效.</p>
<p><b>注意:</b> active必须在hover之后定义是有效的.</p>
</body>
</html>