请教CSS给链接不同的样式
.daodu:link {
font-size: 9pt;
color: #666666;
text-decoration: none;
}
.daodu:hover {
font-size: 9pt;
color: #ff0000;
text-decoration: none;
background-color:#cccccc
}
.daodu:visited {
font-size: 9pt;
color: #666666;
text-decoration: none;
}
a:link{
color:#009966;
text-decoration:none;
}
a:hover{
color:#006666;
text-decoration:underline;
}
a:active{
color:#009966;
text-decoration:none;
}
a:visted{
color:#009966;
text-decoration:none;
}
如上,有2种链接样式,在1.css文件里。
如何实现两种样式的链接呢,怎么只有a的样式有效呢,daodu的样式没有了?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link rel="stylesheet" type="text/css" href="1.css">
</head>
<body>
<p align="center"><a href="#">床前明月光</a></p>
<p align="center" class="daodu"><a href="#">疑是地上霜</a></p>
<p align="center"><a href="#">举头忘明月</a></p>
<p align="center" class="daodu"><a href="#">低头思故乡</a></p>
</body>
</html>
------解决方案--------------------daodu的样式改成这样
.daodu a:link {
font-size: 9pt;
color: #666666;
text-decoration: none;
}
.daodu a:hover {
font-size: 9pt;
color: #ff0000;
text-decoration: none;
background-color:#cccccc
}
.daodu a:visited {
font-size: 9pt;
color: #666666;
text-decoration: none;
}