真正的普京已经死了:关于网页css样式的问题

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/09 17:51:44
在同一个页面中,加了链接的文字,已经有一个样式,
可是我想在这个页面中对已有链接的文字有两种不同的样式,
就做不出来了,
加一个链接它就会默认第一个样式,
第二种怎么加呀

a:link {
font-size: 9pt;
line-height: 18pt;
color: #000000;
text-decoration: none;
}
a:visited {
font-size: 9pt;
line-height: 18pt;
color: #FF6600;
text-decoration: none;
}
.b:link {
font-size: 9pt;
line-height: 18pt;
color: #000000;
text-decoration: none;
}
.b:visited {
font-size: 9pt;
line-height: 18pt;
color: #FF6600;
text-decoration: none;
}

使用第2个的时候用class=b就可以了
比如
<a class=b href="">abcd</a>

先设定两样式,具体做法如下
样式:我们分设定为style1、style2
链按文字,我们假设为:linkType1、linkType2
样式的设定如下:
.style1:link{color: #ececec;text-decoration: none;}
//定义链接样式1的样式
.style1:visited{color: #ececec;text-decoration: none;}
//定义链接样式1访问后的样式
.style1:hover, a:active{color: #00CCFF;text-decoration: none;}
//定义链接样式1当鼠标移动到文字上的样式与当前正在访问时的样式

.style2:link{color: #ff6600;text-decoration: none;}
//定义链接样式2的样式
.style2:visited{color: #ececec;text-decoration: none;}
//定义链接样式2访问后的样式
.style2:hover, a:active{color: #00CCFF;text-decoration: none;}
//定义链接样式2当鼠标移动到文字上的样式与当前正在访问时的样式

然后在文字部分加上如下代码
<a href="#"class="style1">linkType1</a> <a href="#" class="style2">linkType2</a>

完整写法如下:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style2:link{color: #ff6600;text-decoration: none;}
.style2:visited{color: #00cc00;text-decoration: none;}
.style2:hover, a:active{color: #00CCFF;text-decoration: none;}

.style1:link{color: #660006;text-decoration: none;}
.style1:visited{color: #00cc00;text-decoration: none;}
.style1:hover, a:active{color: #00CCFF;text-decoration: none;}

-->
</style>
</head>

<body>
<a href="#"class="style1">linkType1</a> <a href="#" class="style2">linkType2</a>
</body>
</html>

也欢迎去我的网站交流
http://www.cgfinal.com

你在所要加的文字上做一下标记
比如 class=11
然后在对11进行样式设定