码迷,mamicode.com
首页 > Web开发 > 详细

【CSS3 DEMO】扑克正反面翻牌效果

时间:2015-01-12 12:48:39      阅读:406      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

技术分享

用到两个属性:

一个是动画时间

transition-duration: 0.8s;
-moz-transition-duration: 0.8s;
-webkit-transition-duration: 0.8s;
-o-transition-duration: 0.8s;

  

一个是3d

transform: rotate3d(0,1,0,-180deg);
-webkit-transform: rotate3d(0,1,0,-180deg);
-moz-transform: rotate3d(0,1,0,-180deg);

  

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS3卡牌翻牌效果 DEMO</title>

<style type="text/css"> 
.drawbox{width: 200px;height: 180px; position: relative;}
.drawbox-front, .drawbox-behand{ position: absolute;top:0;left:0;z-index: 0;transition-duration: 0.8s;-moz-transition-duration: 0.8s;-webkit-transition-duration: 0.8s;-o-transition-duration: 0.8s;transform: rotate3d(0,1,0,-180deg);-webkit-transform: rotate3d(0,1,0,-180deg);-moz-transform: rotate3d(0,1,0,-180deg);}
.drawbox-front{z-index: 1;transform: rotate3d(0,1,0,0deg);-webkit-transform: rotate3d(0,1,0,0deg);-moz-transform: rotate3d(0,1,0,0deg);}
.drawbox:hover .drawbox-front{z-index: 0;transform: rotate3d(0,1,0,-180deg);-webkit-transform: rotate3d(0,1,0,-180deg);-moz-transform: rotate3d(0,1,0,-180deg);}
.drawbox:hover .drawbox-behand{z-index: 1;transform: rotate3d(0,1,0,0deg);-webkit-transform: rotate3d(0,1,0,0deg);-moz-transform: rotate3d(0,1,0,0deg);}
</style>

</head>
<body>
<div class="drawbox">
    <div class="drawbox-front"><img width="200" height="180" src="http://pic.cnmo-img.com.cn/201501/cnmo200180_03_0107.jpg" alt="" border="0"></div>
    <div class="drawbox-behand"><img width="200" height="180" src="http://pic.cnmo-img.com.cn/201412/ZET2486hp200180news_1224.gif" alt="" border="0"></div>
</div>

</body>
</html>

 

【CSS3 DEMO】扑克正反面翻牌效果

标签:

原文地址:http://www.cnblogs.com/dtdxrk/p/4218098.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!