实例讲解用CSS设置多彩的连接下划线

时间:2007-06-25 01:25:53  来源:站长资讯收集整理  作者:佚名

链接下划线可以改变颜色吗?下面给大家讲解如何利用CSS改变连接下划线颜色。

  我们在进行Web页面设计的时候,根据不同的需要,可能会想要去除链接下划线的效果。而此效果只需要一句话就可以解决了。代码如下:

    text-decoration:none;

  如果保留着链接文字的下划线,默认的颜色属性是如链接文字同样的颜色,看下面的例子:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>www.chinahtml.com</title>
<style type="text/css">
<!--
a.texta {
 text-decoration:underline;
 color:#c00;
}
a.texta:hover {
 color:#666;
}

a.textb {
 text-decoration:overline;
 color:#069;
}
a.textb:hover {
 color:#000;
}
-->
</style>
</head>
<body>
<a href="http://www.chinahtml.com/" class="texta">www.chinahtml.com</a>----underline<br /><br />
<a href="http://www.chinahtml.com/" class="textb">www.chinahtml.com</a>----overline<br /><br />
</p>
</body>
</html>

文章评论

共有 位CH网友发表了评论 查看完整内容