效果演示
源码(CSS已嵌入body)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="http://at.alicdn.com/t/c/font_4096975_pswyqyk8tdo.css">
</head>
<body>
<div>
<ul>
<li>
<span class="iconfont icon-QQ"></span>
<span class="iconfont icon-QQ"></span>
</li>
<li>
<span class="iconfont icon-weixin"></span>
<span class="iconfont icon-weixin"></span>
</li>
<li>
<span class="iconfont icon-douyin"></span>
<span class="iconfont icon-douyin"></span>
</li>
</ul>
</div>
<style>
*{
margin: 0;
padding: 0;
}
ul{
width: 180px;
height: 45px;
/* background-color: #000; */
color: #fff;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
display: flex;
list-style: none;
}
ul li{
position: relative;
margin: 0 10px;
width: 40px;
height: 40px;
}
ul li span{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
line-height: 40px;
text-align: center;
cursor: pointer;
font-size: 40px !important;
}
ul li span:first-child{
height: 0;
z-index: 2;
}
ul li:nth-child(1) span:first-child{
border-bottom: 1px solid #1da1f2;
}
ul li:nth-child(2) span:first-child{
border-bottom: 1px solid #25d366;
}
ul li:nth-child(3) span:first-child{
border-bottom: 1px solid #f00;
}
ul li:nth-child(3) span{
font-size: 32px !important;
}
ul li span{
transition: all 0.5s ease-in-out;
}
ul li:nth-child(1):hover span:first-child{
color: #1da1f2;
height: 100%;
}
ul li:nth-child(2):hover span:first-child{
color: #25d366;
height: 100%;
}
ul li:nth-child(3):hover span:first-child{
color: #f00;
height: 100%;
}
ul li span{
color: #222;
}
</style>
</body>
</html>