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中的两个特殊值用于控制层叠的inherit和initial的方法
CSS3 input框的实现代码类似Google登录的动画效果
CSS 容器背景 10 种颜色渐变Demo(linear-gradient())
详解CSS文件中的4种引入方式:行内,内联式,外部式,导入式
网友评论