按钮效果
当鼠标悬停按钮上时,文字向左滑动,并且在右侧箭头从右向左滑出当鼠标再次离开按钮时,文字向右滑动回原位置,并且右侧滑出箭头向右隐藏
附上过渡效果代码
<head>
<meta charset="UTF-8">
<title>按钮显示箭头动画transition过度</title>
<style>
.button{
border:none;
background-color:red;
color:white;
padding:15px 20px;
font-size:15px;
cursor:pointer;
border-radius:5px;
width:150px;
}
.button span{
position: relative;
display: inline-block;
transition: .5s;
}
.button span::after{
content: "»";
opacity:0;
right:-20px;
position: absolute;
transition: .5s;
}
.button:hover span{
padding-right: 25px;
}
.button:hover span:after{
opacity: 1;
right: 0;
}
</style>
</head>
<body>
<button class="button"><span>我是按钮</span></button>
</body>