css動畫之旋轉翻牌效果,具體內容如下所示:
1、我們先設置兩個盒子大小,顏色等等,然后定位重疊在一起,最后再進行動畫設置
例子如下:
<style> .box { height: 300px; width: 300px; position: relative; } .zh, .fan { height: 300px; width: 300px; line-height: 300px; font-size: 30px; text-align: center; color: blue; transition: all 2s; backface-visibility: hidden; /* 背面不可見 */ position: absolute; top: 0; left: 0; } .zh { background-color: aqua; } .fan { background-color: aquamarine; transform: rotateY(-180deg) rotateZ(-180deg); } .box:hover .zh { transform: rotateY(180deg) rotateZ(180deg) } .box:hover .fan { transform: rotateY(0) rotateZ(0); } </style></head><body> <div class="box"> <div class="zh">正面</div> <div class="fan">反面</div> </div></body>
2、效果如下:
總結
以上所述是小編給大家介紹的css實現旋轉翻牌動畫效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!
如果你覺得本文對你有幫助,歡迎轉載,煩請注明出處,謝謝!
新聞熱點
疑難解答