div{ width: 1200px; margin:0 auto; } ul#n..."/>
您好,登錄后才能下訂單哦!
鼠標滑過字體顏色從左向右漸變:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> *{ margin:0; padding:0; } body>div{ width: 1200px; margin:0 auto; } ul#nav{ background: #11120D; } ul#nav li{ display: inline-block; } ul#nav li a{ position: relative; display: block; color:#fff; text-decoration: none; line-height: 50px; margin:0 10px; } /*這里是主要的效果*/ a:hover { color: #00a78e; } a:hover::before { max-width: 100%; } a::before{ position: absolute; top: 0; left: 0; overflow: hidden; max-width: 0; height: 80%; border-bottom: 3px solid #00a78e; color: #00a78e; content: attr(data-hover); -webkit-transition: max-width 0.4s; -moz-transition: max-width 0.4s; transition: max-width 0.4s; } </style> </head> <body> <div> <ul id="nav"> <li> <a href="#home" data-hover="主頁">主頁</a> </li> <li> <a href="#service" data-hover="服務">服務</a> </li> <li> <a href="#about" data-hover="關于我">關于我</a> </li> <li> <a href="#home" data-hover="主頁">主頁</a> </li> <li> <a href="#service" data-hover="服務">服務</a> </li> <li> <a href="#about" data-hover="關于我">關于我</a> </li> <li> <a href="#home" data-hover="主頁">主頁</a> </li> <li> <a href="#home" data-hover="主頁">主頁</a> </li> <li> <a href="#service" data-hover="服務">服務</a> </li> <li> <a href="#about" data-hover="關于我">關于我</a> </li> <li> <a href="#home" data-hover="主頁">主頁</a> </li> </ul> </div> </body> </html>
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。