我如何获得像here中的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;
}
之前谢谢你
答案 0 :(得分:3)
<强> See this Demo 强>
<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 );
}
答案 1 :(得分:1)
请使用此功能。不需要在&#34;中使用转换:hover&#34;选择器。
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);}