css|链接
在前面,我们说过了链接文字的下划线的一些情况,现在我们考虑如何实现链接文字产生阴影?当鼠标移到链接文字上时,链接文字可以改变颜色,并产生一定的阴影而营造出立体效果,一定比较引人注目。
链接文字阴影效果CSS代码:
ul,li{ margin:0px; padding:0px; list-style-type: none;}
#nav{font-family: Verdana, "宋体", Arial;}
#nav li{ float:left; margin-left:30px;}
#nav span{display:none;}
#nav a{font-size:12px; font-weight:800; color:#c00; text-decoration:none; display:block;}
#nav a:hover{ color:#999;top:1px; left:1px; position:relative;}
#nav a:hover span{ display:block; top:-1px; left:-2px; position:absolute; color:#000; cursor:pointer;}
链接文字阴影效果XHTML代码:
<div id="nav">
<ul>
<li><a href="Webjx.Comhttp://www.webjx.com/">Webjx.Com<span>网站首页</span></a></li>
<li><a href="Div+CSS'>http://www.webjx.com/">Div+CSS教程<span>Div+CSS教程</span></a></li>
<li><a href="CSS'>http://www.webjx.com/">CSS布局实例<span>CSS布局实例</span></a></li>
<li><a href="CSS2.0'>http://www.webjx.com/">CSS2.0教程<span>CSS2.0教程</span></a></li>
<li><a href="CSS'>http://www.webjx.com/">CSS在线手册<span>CSS在线手册</span></a></li>
<li><a href="Web'>http://www.webjx.com/">Web标准<span>Web标准</span></a></li>
<li><a href="XHTML'>http://www.webjx.com/">XHTML教程<span>XHTML教程</span></a></li>
</ul>
</div>
链接文字阴影效果实例:
<!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.webjx.com</title><style type="text/css"><!-- ul,li{ margin:0px; padding:0px; list-style-type: none;} #nav{font-family: Verdana, "宋体", Arial;} #nav li{ float:left; margin-left:30px;} #nav span{display:none;} #nav a{font-size:12px; font-weight:800; color:#c00; text-decoration:none; display:block;} #nav a:hover{ color:#999;top:1px; left:1px; position:relative;} #nav a:hover span{ display:block; top:-1px; left:-2px; position:absolute; color:#000; cursor:pointer;}--></style></head><body><div id="nav"> <ul> <li><a href="http://www.webjx.com/">Webjx.Com<span>网站首页</span></a></li> <li><a href="http://www.webjx.com/">Div+CSS教程<span>Div+CSS教程</span></a></li> <li><a href="http://www.webjx.com/">CSS布局实例<span>CSS布局实例</span></a></li> <li><a href="http://www.webjx.com/">CSS2.0教程<span>CSS2.0教程</span></a></li> <li><a href="http://www.webjx.com/">CSS在线手册<span>CSS在线手册</span></a></li> <li><a href="http://www.webjx.com/">Web标准<span>Web标准</span></a></li> <li><a href="http://www.webjx.com/">XHTML教程<span>XHTML教程</span></a></li> </ul></div></body></html>
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]