首页 > Web开发 > 详细

CSS 3D图片翻转 ——3D Flipping Effect

时间:2019-10-21 22:02:45      阅读:78      评论:0      收藏:0      [点我收藏+]

效果:
技术分享图片
代码如下:

<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
  <title>3D Flipping Effect</title>
  <link rel="stylesheet" type="text/css" href="css/iconfont.css"/>
  <style type="text/css">
   *{
    margin: 0;
    padding: 0;
   }
   
   body{
    height: 100vh;
    background-color: #bdc3c7;
    color: white;
   }
   
   .middle{
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
   }
   
   .wrap{
    width: 300px;
    height: 500px;
    position: relative;
   }
   .wrap h2{
    font-size: 40px;
    margin-bottom: 20px;
   }
   
   .front , .back{
    width: 100%;
    height: 100%;
    position: absolute;
    background: url(../img/bg.jpg);
    background-size: cover;
    backface-visibility: hidden;
    box-shadow: 0 0 10px #2c3e50;
    transition: .8s;
   }
   
   .front{
    transform: perspective(800px) rotateY(0deg);
   }
   
   .back{
    transform: perspective(800px) rotateY(180deg);
   }
   
   .back .contact-info{
    margin-top: 10px;
   }
   
   .back .contact-info a{
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    text-decoration: none;
    color: #d1d8e0;
    border-radius: 50%; 
   }
   
   .back .contact-info a:hover{
    color: white;
    background-color: #4a69bd;
   }
   
   .wrap:hover .front{
    transform: perspective(800px) rotateY(-180deg);
   }
   
   .wrap:hover .back{
    transform: perspective(800px) rotateY(0deg);
   }
  </style>
 </head>
 <body class="middle">
  <div class="wrap">
   <div class="front middle">
    <h2>愿意</h2>
    <h3>用一支黑色的铅笔</h3>
    <h3>画一出沉默舞台剧</h3>
   </div>
   
   <div class="back middle">
    <h2>愿意</h2>
    <h3>在角落唱沙哑的歌</h3>
    <h3>再大声也都是给你</h3>
    <div class="contact-info">
     <a href="#"><i class="iconfont icon-weibo"></i></a>
     <a href="#"><i class="iconfont icon-weixin"></i></a>
     <a href="#"><i class="iconfont icon-tuite"></i></a>
     <a href="#"><i class="iconfont icon-youtube"></i></a>
    </div>
   </div>
  </div>
  
 </body>
</html>

CSS 3D图片翻转 ——3D Flipping Effect

原文:https://www.cnblogs.com/alongz/p/11715641.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!