css怎麼實現卡片映像翻轉效果?(特效樣本)

來源:互聯網
上載者:User
在我們瀏覽多圖網站時,單單的靜止映像展現往往太過平凡。遠不足以吸引使用者,有趣的css動畫更能引人注目,那麼本篇文章關於css圖片翻轉的特效進行詳細的介紹,具有一定的參考價值,希望對有需要的朋友有所協助。

css翻轉(圖片)具體程式碼範例:

HTML代碼部分

<div class="display back">            <h3>css圖片翻轉樣本</h3>          </div>        </div>      </div>      <div class="wrap">        <div class="image">          <div class="display front">            <img src="img.jpg" alt="" />          </div>

css代碼部分:

* {        padding: 0;        margin: 0;      }      body {        background-color: rgb(244, 244, 244);      }          .wrap {        -webkit-perspective:400;        -moz-perspective:400;        float: left;        width: 220px;        margin-right: 20px;      }      .image {        width: 100%;        height: 200px;        -webkit-transform-style:preserve-3d;        -webkit-transition:1.5s;        -moz-transform-style:preserve-3d;        -moz-transition:1.5s;      }      img {        width: 220px;        height: 200px;      }      .wrap:hover .image {        -webkit-transform:rotateY(180deg);        -moz-transform:rotateY(180deg);      }      .display {        position: absolute;        -webkit-backface-visibility:hidden;        -moz-backface-visibility:hidden;      }      .display h3 {        color: white;        text-align: center;      }      .back {        -webkit-transform:rotateY(180deg);        -moz-transform:rotateY(180deg);        background: -webkit-gradient(linear,left top,left bottom,from(#fdbb5a), to(#db5726));        background: -moz-linear-gradient(top,#fdbb5a,#db5726);        width: 220px;        height: 200px;        line-height: 200px;      }

以上代碼效果如:

css卡牌翻轉效果,能讓你看到一張卡片的正反兩面上的內容。

註:perspective 屬性定義 3D 元素距視圖的距離,以像素計。該屬性允許您改變 3D 元素查看 3D 元素的視圖。

當為元素定義 perspective 屬性時,其子項目會獲得透視效果,而不是元素本身。perspective 屬性隻影響 3D 轉換元素。

可能的值有:

number 元素距離視圖的距離,以像素計。

none 預設值。與 0 相同。不設定透視。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.