摘要:<!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"> <script type="text/javascript" src="static/js/jquery-3.3.1.js"></script> <title>Document</title> <style> * { padding: 0px; margin: 0px; } div { width: 100%; height: 30px; background-color: lightskyblue } ul { width: 500px; height: inherit; margin: 0 auto; line-height: 30px; } ul li { list-style: none; float: left; margin: 0 30px; text-align: center; border: none; position: relative; width: 80px; } span { display: inline-block; width: 80px; height: 2px; background-color: lightcoral; position: absolute; top: 30px; left: 0px; } </style> </head> <body> <div> <ul> <li>首页 <span></span> </li> <li>会员中心 <span></span> </li> <li>网站导航 <span></span> </li> </ul> </div> <script> $(document).ready(function () { $('span').hide() $('li').mouseover(function () { $(this).find('span').show(300) }) $('li').mouseout(function () { $(this).find('span').hide() }) }) </script> </body> </html>
批改老师:韦小宝批改时间:2019-01-22 16:37:29
老师总结:不错不错 写的很棒 代码写的也很规范 课后记得多练习几种案例玩玩哦