css3实现卡片翻转
2015-09-13 20:34
756 查看
真的是好记性不如乱笔头,以前看过了css3实现卡片翻转,觉得简单,也就没做笔记,今天在写了,一头蒙啊。。
需要用到的css3:属性:
1、perspective:800px;景深:一般设给舞台,
2、transform-style:preserve-3d;3d场景,一般设给容器,也就是那个施加动画的元素
3、backface-visibility:hidden ;是否显示该选择元素旋转到背面后的样子
4、transform:rotateY(0deg);元素绕Y轴旋转
例子:
相关教程:时而复习
需要用到的css3:属性:
1、perspective:800px;景深:一般设给舞台,
2、transform-style:preserve-3d;3d场景,一般设给容器,也就是那个施加动画的元素
3、backface-visibility:hidden ;是否显示该选择元素旋转到背面后的样子
4、transform:rotateY(0deg);元素绕Y轴旋转
例子:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> * {margin: 0;padding: 0} #wrap {width: 600px;height: 600px;background: #ccc; margin: 0 auto;position: relative;perspective:800px;} #box {position: absolute;left: 100px;width: 400px;height: 400px;border: 1px solid #000;transform-style:preserve-3d; transform-origin: right center;} #box a {display: block;width: 100%;height: 100%;position: absolute;left: 0;top: 0;font-size: 28px; backface-visibility: hidden;color: #fff} #box a:nth-of-type(1) {background: blue;transition:.8s transform} #box a:nth-of-type(2) {background: red;transform:rotateY(-180deg);transition:.8s transform} #box:hover a:nth-of-type(1) {transform:rotateY(180deg);} #box:hover a:nth-of-type(2) {transform:rotateY(0deg);} </style> </head> <body> <div id="wrap"> <div id="box"> <a href="#" id="one">世界那么大</a> <a href="#" id="two">我想去看看</a> </div> </div> </body> </html>
相关教程:时而复习
相关文章推荐
- CSS3属性教程与案例分享
- CSS3属性教程与案例分享
- CSS3的calc()使用
- 使用CSS3的appearance属性改变元素的外观
- CSS3美化图片
- CSS3质感分析——表面线性渐变
- 分析选项卡底部内凹圆角制作
- 细说百度图片栏目——图片展示效果
- 8个实用的响应式设计框架
- 20+ Animation Scripts, Libraries and Plugins
- 如何使用CSS3画出一个叮当猫
- CSS3实例分享之多重背景的实现(Multiple backgrounds)
- 低版本IE正常运行HTML5+CSS3网站的3种解决方案
- CSS3中Transition属性详解以及示例分享
- jquery+CSS3模拟Path2.0动画菜单效果代码
- 分享33个jQuery与CSS3实现的绚丽鼠标悬停效果
- jquery和css3实现的炫酷时尚的菜单导航
- 实现音乐播放器的代码(html5+css3+jquery)
- 基于jquery css3实现点击动画弹出表单源码特效
- 2014 HTML5/CSS3热门动画特效TOP10