纯css3 卡片动画

2017-12-15  本文已影响45人  科哚洛夫

纯css3 卡片动画

如图:


WechatIMG269.jpeg WechatIMG270.jpeg
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <link rel='stylesheet prefetch' href='http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css'>
    <style>
        .card{
            position: absolute;
            top: 50%;
            left: 50%;
            width: 370px;
            background:#fff;
            overflow: hidden;
            box-shadow: 0 20px 50px rgba(0,0,0,0.1);
            transition: -webkit-box-shadow 0.5s;
                    transition: box-shadow 0.5s;
                     -webkit-transform: translateX(-50%) translateY(-50%) translateZ(0);
          transform: translateX(-50%) translateY(-50%) translateZ(0);                   
        }
        .card:hover {
            box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
        }

        .thead{
            height: 257px;
            overflow: hidden;
            background:#000;
            transition: height 0.5s;
        }
        .card:hover .thead{
            height: 180px;
        }
        .card:hover .thead a img{
            opacity: 0.6;
            transform: scale(1.2);
        }
        .card:hover .content{
            height: 297px;
        }
        .thead a img{
            width: 100%;
            height: 100%;
            transform: scale(1);
            opacity: 1;
              -webkit-transition: opacity 0.5s, -webkit-transform 0.5s;
              transition: opacity 0.5s, -webkit-transform 0.5s;
              transition: opacity 0.5s, transform 0.5s;
              transition: opacity 0.5s, transform 0.5s, -webkit-transform 0.5s;
        }
        
        .content{
            position: relative;
            height: 220px;
            overflow: hidden;
            background:#fff;
            transition: height 0.5s;
        }
        .title{
            display: block;
            padding:0 10px;
            font-size: 14pt;
            text-transform: lowercase;
        }
        .message{
            color:#F29B39;
            font-size: 14pt;
            position: absolute;
            left: 10px;
            top: 100px;
            -webkit-transform: translateY(20px);
            transform: translateY(20px);
            -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
            transition: opacity 0.3s, transform 0.3s, -webkit-transform 0.3s;
            transition: opacity 0.3s, -webkit-transform 0.3s;
            transition: opacity 0.3s, transform 0.3s;
            -webkit-transition-delay: 0s;
            transition-delay: 0s;
        }
        .card:hover .message{
            opacity: 1;
            position: absolute;
            top:100px;
            -webkit-transform: translateY(0);
            transform: translateY(0);
            -webkit-transition-delay: 0.2s;
            transition-delay: 0.2s;
        }
        .Hcontent{
            position: absolute;
            bottom:40px;
            padding:0 10px;
            overflow: hidden;
            opacity: 0;
            text-transform: uppercase;
            -webkit-transform: translateY(45px);
            transform: translateY(45px);
            -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
            transition: opacity 0.3s, transform 0.3s, -webkit-transform 0.3s;
            transition: opacity 0.3s, -webkit-transform 0.3s;
            transition: opacity 0.3s, transform 0.3s;
            -webkit-transition-delay: 0s;
            transition-delay: 0s;
        }
        .card:hover .Hcontent{
            opacity: 1;
            -webkit-transform: translateY(0);
            transform: translateY(0);
            -webkit-transition-delay: 0.2s;
            transition-delay: 0.2s;
        }
        .card__footer {
            position: absolute;
            bottom: 12px;
            left: 20px;
            right: 20px;
            font-size: 11px;
            color: #A3A9A2;
        }

        .icon {
            display: inline-block;
            vertical-align: middle;
            margin: -2px 0 0 2px;
            font-size: 18px;
        }
        .icon + .icon {
            padding-left: 10px;
        }

    </style>
</head>
<body>
    <article class="card">
        <header class="thead">
            <a href="javascript:;"><img src="http://ot852xyvt.bkt.clouddn.com/WechatIMG268.jpeg" alt=""></a>
        </header>
        
        <div class="content">
            <h1 class="title">Today, write a card css3 effect, share to share to everyone at the same time, baidu searches geng xiao jun</h1>
            <p class="message">Leave a message bai</p>
        </div>
        <div class="Hcontent">
            <p>Yeah, but I'm going to conquer you with my eight beats, whether you like it or not, so you're going to kneel with my freestyle</p>
        </div>
        <footer class="card__footer">
            <span class="icon ion-clock"></span> 6min ago
        </footer>
    </article>
</body>
</html>

手写不易 给个赞呗 !

上一篇 下一篇

猜你喜欢

热点阅读