Internet Explorer中沒有按」 t 目前支持preserve-3d
,但該團隊在即將發佈的版本中爲working to ship it。這就是說,像你這樣簡單的例子不一定需要這個特性,並且可以用更多的瀏覽器來實現。
我打得有點與獨立兩個僞元素轉換複製你的效果:
<div id="button1">
<!-- Preserved your markup -->
<a href="#" data-text="Search Now!"></a>
</div>
a {
position: relative;
perspective: 500px;
}
a, a::before, a::after {
color: #FFF;
display: inline-block;
line-height: 44px;
box-sizing: border-box;
width: 155px; height: 44px;
backface-visibility: hidden;
text-decoration: none;
text-align: center;
}
a::before, a::after {
top: 0; left: 0;
position: absolute;
content: attr(data-text);
transition: transform 1s;
}
a::before {
background: #0965A0;
transform-origin: 50% 100%;
}
a::after {
background: #2195DE;
transform-origin: 50% 0%;
transform: translateY(100%) rotateX(-90deg);
}
a:hover::before {
transform: translateY(-100%) rotateX(90deg);
}
a::before, a:hover::after {
transform: translateY(0) rotateX(0);
}
小提琴:http://jsfiddle.net/jonathansampson/ybjv8d7x/
如何Firefox的反應? IE 10/9/8? – lucrativelucas