纯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;
0;
height: 100%;
border-bottom: 2px solid #000;
}
li:hover::after {
100%;
}
</style>
</head>
<body>
<ul>
<li>不可思议的CSS</li>
<li>导航栏</li>
<li>光标小下划线跟随</li>
<li>PURE CSS</li>
<li>Nav Underline</li>
</ul>
</body>
</html>