abstract:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>下划线</title> <link rel="stylesheet" href="css/php.css" type="text/css"> <script src="js/jquery-3.3.1.js"></script> <script src="js/php.js" type="text/javascript"></script> <style> /* 下划线跟随导航 */ .menu_line{width: 80%;margin: 0 auto; height: 40px;background: #ccc;margin-top: 30px;position: relative;} .menu_line ul{width: 100%;margin: 0 auto;} .menu_line ul li{list-style: none;width: 150px;height: 40px;line-height: 40px;text-align: center;float: left;background: #ea5404; border-right: 1px solid #fff;} .bottom_line{width: 150px;height: 2px;position: absolute;background: #000;top: 40px;left: 10%;} .menu_line ul li:last-child{border-right: 0px;} .menu_line ul li a{text-decoration: none;color: #000;} </style> <script> //下划线跟随导航 $(function(){ $('.bottom_line').stop().css({'left':'0px'}); $('.menu_line ul>li').hover( function(){ $leng = parseInt($(this).attr('name'))*150; $('.bottom_line').stop().animate({'left':$leng+'px'},'slow'); }, function(){ $('.bottom_line').stop().animate({'left':'0px'},'slow'); } ) }) </script> </head> <body> <div class="clear"></div> <div class="menu_line"> <ul> <li name="0"><a href="">首页</a></li> <div class="bottom_line"></div> <li name="1"><a href="">新闻中心</a></li> <li name="2"><a href="">品牌简介</a></li> <li name="3"><a href="">来院路线</a></li> <li name="4"><a href="">创业中心</a></li> <li name="5"><a href="">福利</a></li> <li name="6"><a href="">项目</a></li> </ul> </div> </body> </html>
Correcting teacher:灭绝师太Correction time:2018-11-20 16:08:33
Teacher's summary:效果没问题,布局太丑了,这色调,还有导航栏宽度错了,滑动距离要调整下