卡牌效果:O(∩_∩)O,只做了webkit浏览器的效果,请用chrome~

1、首先呢,先用一个框框把卡牌包住,然后呢,搞两个子元素作为卡牌正反面。当然咯,反面是看不见滴~

<section class=wrap>
<div class="face front">Lisen to me</div>
<div class="face back">Yes, I will</div>
</section>

HTML

2、然后就开始写CSS做变换了。

.wrap {
width: 250px;
height: 400px;
-webkit-perspective:;
-webkit-transform-style: preserve-3d;
-webkit-transition: 1s;
}
.face {
position: absolute;
-webkit-backface-visibility: hidden;
}
.wrap:hover {
-webkit-transform: rotateY(180deg);
}
.back {
width: 100%;
height: 100%;
background: -webkit-linear-gradient(top, rgba(0,0,0,.65) 0%, rgba(0,0,0,0) 100%);
-webkit-transform: rotateY(180deg);
}
.front {
width: 100%;
height: 100%;
background: -webkit-linear-gradient(90deg, #b01c20 0%, pink 100%);
}

CSS

CSS代码详解:

1、.wrap作为外围框的类,需要设置3D视野perspective,美术渣渣表示不懂这个属性,但是经过实验,个人偏好数值比较大。然后要设置3D变换transform-style。最后设置3D变换过渡的时间,即transition属性。

2、.face作为卡牌正反面的类,需要设置position:absolute,好让第二个子元素脱离文档流,否则第二个子元素会被放在第一个子元素之后。然后设置背面的元素不可见。

3、.back作为背面的卡牌,首先呢,它得在逆时针旋转180deg。我把.face的backface-visibility属性去掉,然后我们可以看到旋转的效果。

Card Flip的更多相关文章

  1. [CSS] Create a Card Flip Animation with CSS

    Animation can be a powerful way to enhance a user experience. In this lesson, we'll walk through the ...

  2. 【Android Developers Training】 71. 显示翻牌动画

    注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...

  3. Android Training

    Building Apps with Content Sharing Simple Data --> Intent && ActionProvider 介绍如何让应用程序共享简单 ...

  4. AndroidScreenSlide项目切换view动画效果《IT蓝豹》

    AndroidScreenSlide项目切换view动画效果 AndroidScreenSlide项目中有几个不错的效果,一:Card Flip翻页立体效果,二:Screen Slide 左右切换vi ...

  5. 介绍css 的3D 变换(3D transform)

    https://desandro.github.io/3dtransforms/docs/card-flip.html ---------------------------------------- ...

  6. Webpack + VueJS 学习、跳坑和总结

    这篇随笔会陆续地更新下去,用于汇集一些关于Webpack的初学跳坑总结还有VueJS的基础知识. Webpack部分 ① 快速建立一个Webpack-Vue项目开发环境(4.39.1-2019/08/ ...

  7. [OpenJudge 3061]Flip The Card

    [OpenJudge 3061]Flip The Card 试题描述 There are N× Ncards, which form an N× Nmatrix. The cards can be p ...

  8. [Swift]LeetCode822. 翻转卡片游戏 | Card Flipping Game

    On a table are N cards, with a positive integer printed on the front and back of each card (possibly ...

  9. [LeetCode] Card Flipping Game 翻卡片游戏

    On a table are N cards, with a positive integer printed on the front and back of each card (possibly ...

随机推荐

  1. Heartbeat+DRBD+MySQL高可用方案

    1.方案简介 本方案采用Heartbeat双机热备软件来保证数据库的高稳定性和连续性,数据的一致性由DRBD这个工具来保证.默认情况下只有一台mysql在工作,当主mysql服务器出现问题后,系统将自 ...

  2. CI,从数据库读取数据

    1.准备数据库,(用户,密码,数据库服务的地址) 2.CI链接数据库,配置database.php(配置文件)       //application/config/database.php 3.准备 ...

  3. myBatis oracle 与mysql自增问题

    mysql <insert id="insert" parameterType="Person" useGeneratedKeys="true& ...

  4. phpexcel引入MVC框架会导致__autoload引入类文件失败的解决办法

    Autoloader.php 的register和load方法 register方法 if (function_exists('__autoload')) { // Register any exis ...

  5. canvas中的rotate的使用方法

    今天在绘制一个足球滚动的时候,想使用rotate方法,之前看到这个方法的时候,并没有引起任何重视,无非就是和CSS3里的rotate一样的用么... 遗憾的是,事实并非如此,由于代码在公司,我也就不去 ...

  6. React Native 中 CSS 的使用

    首先声明,此文原作者为黎 跃春 React Native中CSS 内联样式 对象样式 使用Stylesheet.Create 样式拼接 导出样式对象 下面的代码是index.ios.js中的代码: / ...

  7. swif-throws异常抛出

    import UIKit enum VendingMachineError: Error { case invalidSelection //选择无效 case insufficientFunds(c ...

  8. NodeJs并发异步的回调处理

    这里说并发异步,并不准确,应该说连续异步.NodeJs单线程异步的特性,直接导致多个异步同时进行时,无法确定最后的执行结果来回调.举个简单的例子: for(var i = 0; i < 5; i ...

  9. JavaScript Array 常用函数整理

    按字母顺序整理 索引 Array.prototype.concat() Array.prototype.filter() Array.prototype.indexOf() Array.prototy ...

  10. 怎么找到苹果App Store的应用程序下载链接地址

    http://jingyan.baidu.com/article/6dad5075f6fa79a123e36e85.html 怎么找到苹果App Store的应用程序下载链接地址 每个上传到苹果app ...