CSS3系列之3D製作 再研究

來源:互聯網
上載者:User

標籤:

水平翻轉效果:

<!DOCTYPE html><html><head><meta charset="UTF-8"><title></title><style type="text/css">.stage {width: 140px;height: 200px;perspective: 800px;}.container {position: relative;width: 140px;height: 200px;transform-style: preserve-3d;transition: 1s;}.front {position: absolute;width: 140px;height: 200px;        background-image: url(img/3tb_160824110159262h572240.jpg);background-size: cover;backface-visibility: hidden;}.back {position: absolute;width: 140px;height: 200px;background-image: url(img/3tb_160824110159xh65572240.jpg);background-size: cover;transform: rotateY(180deg);backface-visibility: hidden;}.stage:hover .container {transform: rotateY(180deg);}</style></head><body><div class=‘stage‘><div class=‘container‘><div class=‘front‘></div><div class=‘back‘></div></div></div>  </body></html>

 3D 旋轉:

<!doctype html><html lang="en"><head><meta charset="UTF-8" /><title>Document</title><style type="text/css">* {margin: 0;padding: 0;}.wrap {padding: 50px;}.stage {width: 100px;height: 100px;-webkit-perspective: 2000px;perspective: 2000px;list-style: none;}.container {position: relative;width: 100px;height: 100px;-webkit-transform-style: preserve-3d;transform-style: preserve-3d;-webkit-transition: 1s;transition: 1s;}.front {position: absolute;width: 100px;height: 100px;-webkit-transform: translateZ(50px);transform: translateZ(50px);-webkit-backface-visibility: hidden;backface-visibility: hidden;}.front img {width: 100%;height: 100%;}.back {position: absolute;display: block;width: 100px;height: 100px;text-align: center;line-height: 100px;-webkit-transform: rotateY(90deg) translateZ(50px);transform: rotateY(90deg) translateZ(50px);-webkit-backface-visibility: hidden;backface-visibility: hidden;}li:nth-child(1) .back {background-color: skyblue;}li:nth-child(2) .back {background-color: pink;}li:nth-child(3) .back {background-color: lightyellow;}.container:hover {-webkit-transform: rotateY(-90deg);transform: rotateY(-90deg);}</style></head><body><ul class="wrap"><li class="stage"><div class=‘container‘><div class="front"><img src="http://d3.freep.cn/3tb_160824132644ihf4572240.jpg" /></div><p class="back">帥氣的胡歌</p></div></li><li class="stage"><div class=‘container‘><div class="front"><img src="http://d2.freep.cn/3tb_160824132644w0r4572240.jpg" /></div><p class="back">美膩的趙麗穎</p></div></li><li class="stage"><div class=‘container‘><div class="front"><img src="http://d3.freep.cn/3tb_160824235542tkj9572240.jpg" /></div><p class="back">清純的劉亦菲</p></div></li></ul></body></html>

  

CSS3系列之3D製作 再研究

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.