HTML|设置网页链接的属性
在html中可以使用“a“标记建立网页的链接,CSS允许按照链接的状态来设置网页链接的文字效果。语法如下:
a:link 未链接时超链接文字的样式(原本状态)
a:visited 已链接过的超链接文字样式(就是点击过了)
a:active 当鼠标点击的那一刻显示的样式
a:hover 当鼠标移到链接处时的样式
代码演示:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>网页的超链接属性</title>
<style type="text/css">
body{line-height: 25px;}
a:link{color:chartreuse;}
a:visited{color: beige;}
a:active{background-color: crimson;}
a:hover{color: darkorange;}
</style>
</head>
<body>
<ol>
<li><a href="#">websites</a></li>
<li><a href="#">tuesday</a></li>
<li><a href="#">more or less</a></li>
<li><a href="#">just so so</a></li>
<li><a href="#">okkk</a></li>
</ol>
</body>
</html>
注意:active若是定义字体颜色不明显,该处使用的背景颜色定义,变化显而易见。