忽然的想法,想写个纯CSS的飞入飞出效果
效果图:
html代码:
<style>
* {
padding: 0;
margin: 0;
}
body {
background: #f0f0f0;
color: #000;
}
div {
width: 240px;
height: 60px;
padding: 70px 30px;
cursor: pointer;
box-shadow: 0 15px 10px #ddd;
background: #fff;
position: absolute;
z-index: 10;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
transition: 1s all linear;
}
div:hover {
top: -50px;
}
i {
display: block;
height: 5px;
background: #000;
width: 0;
position: absolute;
z-index: 10;
top: 0;
}
i.i01 {
transition: 0;
left: 0;
}
div:hover i.i01 {
width: 100%;
transition: 0.5s all linear;
}
i.i02 {
transition: 0.5s all linear;
right: 0;
}
div:hover i.i02 {
width: 100%;
transition: 0s all 0.5s linear;
}
i.i03 {
width: 100%;
left: 0;
background: #f90;
z-index: 5;
}
span {
display: block;
width: 100%;
line-height: 30px;
}
.title {
font-size: 24px;
}
.text {
font-size: 14px;
color: #999;
}
</style>
<div>
<i class="i01"></i>
<i class="i02"></i>
<i class="i03"></i>
<span class="title">Just title</span>
<span class="text">This is a text.</span>
</div>