【导航】双语导航/导航中鼠标经过变换文字

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>双语导航/导航中鼠标经过变换文字</title>
<style type="text/css">
	* { margin:0; padding:0; }
	.nav { list-style:none; width:500px; height:30px; background:#333; margin:50px auto; }
	.nav li { float:left; width:100px; height:30px; line-height:30px; text-align:center; }
	.nav li a { display:block; height:30px; overflow:hidden; text-decoration:none; color:#fff; font-size:14px; }
	.nav li span { display:block; height:30px; }
	.nav li a:hover { background:#444; }
	.nav li a:hover span { margin-top:-30px; }  /*.nav li a:hover span { display: none; }也能同样达到效果(元素移动或是元素不会被显示)*/
</style>
</head>

<body>
<ul class="nav">
     <li><a href="#"><span>Home</span>网站首页</a></li>
     <li><a href="#"><span>About</span>关于我们</a></li>
     <li><a href="#"><span>News</span>新闻动态</a></li>
     <li><a href="#"><span>Product</span>产品展示</a></li>
     <li><a href="#"><span>Contact</span>联系我们</a></li>
    </ul>
</body>
</html>

这个导航的原理很简单,在注释中已经写好了,通过用margin-top:-30px;移动span元素或是直接用display:none;让span元素不显示。

posted @ 2012-05-02 17:07  huige728  阅读(967)  评论(0编辑  收藏  举报