导航栏中上下滑动酷炫效果。思路:
ul的高度为li的一半,ul{overflow:hidden}
li:hover{margin-top:-40px;}
<!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"> *{padding:0; margin:0;} li{ list-style:none; } a{ text-decoration:none;} .nav{ width:100%; height:40px; background:#222; margin-top:100px; overflow:hidden;} .list{ width:1000px; height:40px; margin:0 auto;} .list li{ float:left;} .list li a{ display:block; transition:0.3s;} .list b,.list i{ display:block; padding:0 30px; color:#aaa; line-height:40px; text-align:center;} .list b{ font-weight:100} .list i{ font-style:normal; background:#333; color:#fff;} .list a:hover{ margin-top:-40px;} </style> </head> <body> <div class="nav"> <ul class="list"> <li> <a href="#"> <b>Index</b> <i>首页</i> </a> </li> <li> <a href="#"> <b>course</b> <i>职业课程</i> </a> </li> <li> <a href="#"> <b>study</b> <i>就业学习</i> </a> </li> <li> <a href="#"> <b>BBS</b> <i>社区</i> </a> </li> <li> <a href="#"> <b>JiKe+</b> <i>发现+</i> </a> </li> </ul> </div> </body> </html>
网友评论文明上网理性发言 已有0人参与
发表评论: