我如何才能获得像这里这样的css过渡示例(下拉示例),到目前为止,我只更改了文本和背景颜色,但没有更改整个过渡效果(矩形在悬停时滚动,在取消悬停时平稳地向后滚动),知道我该如何实现吗?这是我的代码:
a.menulink
{
text-decoration: none;
color: #000000;
background-color: rgb(235,235,185);
-webkit-transition: color .25s linear;
transition: color .25s linear;
transition: background-color .15s linear .1;
}
a.menulink:hover
{
text-decoration: none;
color: #FFFFFF;
background-color: rgb(255,24,24);
-webkit-transition: color .25s linear, background-color .15s linear .1s;
transition: color .25s linear, background-color .15s linear .1s;
}
在之前感谢您
请参阅此演示
<a href="#" class="linkhover">
<span hover-title="LINK HOVER">LINK HOVER</span>
</a>
.linkhover {
display: inline-block;
overflow: hidden;
perspective: 400px;
-webkit-perspective: 400px;
perspective-origin: 50% 50%;
-webkit-perspective-origin: 50% 50%;
}
.linkhover span {
display: block;
position: relative;
transition: all 500ms ease;
-webkit-transition: all 500ms ease;
transform-origin: 50% 0%;
-webkit-transform-origin: 50% 0%;
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
}
.linkhover:hover span {
transform: translate3d( 0px, 0px, -35px ) rotateX( 90deg );
-webkit-transform: translate3d( 0px, 0px, -35px ) rotateX( 90deg );
}
.linkhover span:after {
content: attr(hover-title);
display: block;
position: absolute;
left: 0;
top: 0;
white-space: nowrap;
color: white;
background: red;
transform-origin: 50% 0%;
-webkit-transform-origin: 50% 0%;
transform: translate3d( 0px, 100%, 0px ) rotateX( -90deg );
-webkit-transform: translate3d( 0px, 100%, 0px ) rotateX( -90deg );
}
只需使用此即可。无需在":hover"选择器中使用转换。
a.menulink{
text-decoration: none;
color: #000000;
background-color: rgb(235,235,185);
-webkit-transition: color .25s linear;
transition: color .25s linear;
transition: background-color .15s linear .1s;
}
a.menulink:hover
{
text-decoration: none;
color: #FFFFFF;
background-color: rgb(255,24,24);}