CSS特效(15)——纯css实现导航栏下划线跟随动画

纯css实现导航栏下划线跟随动画

<!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>Document</title>
  <style>
    li{
      display: inline-block;
      position: relative;
    }
  li::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    border-bottom: 2px solid #000;
}
 
li:hover::after {
    width: 100%;
}
  </style>
</head>
<body>
    <ul>
        <li>不可思议的CSS</li>
        <li>导航栏</li>
        <li>光标小下划线跟随</li>
        <li>PURE CSS</li>
        <li>Nav Underline</li>
      </ul>
</body>
</html>
posted @ 2018-09-07 15:36  Janas  阅读(299)  评论(0编辑  收藏  举报