CSS3翻轉效果
分享一段程式碼例項,它實現了元素的3D翻轉效果。
提供了多種型別的翻轉,程式碼例項如下:
[HTML] 純文字檢視 複製程式碼執行程式碼<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>螞蟻部落</title> <style type="text/css"> * { padding: 0; margin: 0; } .container { width: 90%; padding: 5%; height: 12rem; display: flex; justify-content: space-around; } .container > div { width: 10rem; height: 10rem; } img { width: 100%; height: 100%; } a { transition: all 1s ease; display: block; height: 100%; } span { color: #fff; } /*div1*/ .div1 span { display: none; height: 100%; background-color: blue; transform: rotateX(-180deg); } .a1:hover img { display: none; } .a1:hover span { display: block; } .a1:hover { transform: rotateX(180deg) scale(.7,.7 ); } /*div2*/ .div2 span { display: none; height: 100%; background-color: blue; transform: rotateY(-180deg); } .a2:hover img { display: none; } .a2:hover span { display: block; } .a2:hover { transform: rotateY(180deg) scale(.7,.7 ); } /*div3*/ .div3 { perspective: 1000px; } .div3 a { transform-style: preserve-3d; transition: all .5s ease; } .div3 span { display: block; height: 160px; background-color: blue; transform-origin: 50% 0; transform: rotateX(-90deg); margin-top: -8px; } .a3:hover { transform: rotateX(90deg) translate3d(0,-80px,80px); } /*div4*/ .div4 { perspective: 1000px; } .div4 a { transform-style: preserve-3d; transition: all .5s ease; } .div4 span { display: block; height: 160px; background-color: blue; transform-origin: 50% 100%; transform: translateY(-320px) rotateX(90deg); } .a4:hover { transform: rotateX(-90deg) translate3d(0,80px,80px); } /*div5*/ .div5 { perspective: 1000px; } .div5 a { transform-style: preserve-3d; transition: all .5s ease; } .div5 span { display: block; height: 160px; background-color: blue; transform-origin: 0 50%; transform: translate(100%,-100%) rotateY(90deg); margin-top: -3px; } .a5:hover { transform: rotateY(-90deg) translate3d(-60px,0,80px); } /*div5*/ .div6 { perspective: 1000px; } .div6 a { transform-style: preserve-3d; transition: all .5s ease; } .div6 span { display: block; height: 160px; background-color: blue; transform-origin: 100% 50%; transform: translate(-100%,-100%) rotateY(-90deg); margin-top: -3px; } .a6:hover { transform: rotateY(90deg) translate3d(60px,0,80px); } </style> </head> <body> <section class="container"> <div class="div1"> <a href="###" class="a1"> <img src="demo/CSS/img/100x100.png"> <span>軸向二維翻轉</span> </a> </div> <div class="div2"> <a href="###" class="a2"> <img src="demo/CSS/img/100x100.png"> <span>橫向向二維翻轉</span> </a> </div> <div class="div3"> <a href="###" class="a3"> <img src="demo/CSS/img/100x100.png"> <span>3D上翻轉</span> </a> </div> </section> <section class='container'> <div class="div4"> <a href="###" class="a4"> <img src="demo/CSS/img/100x100.png"> <span>3D下翻轉</span> </a> </div> <div class="div5"> <a href="###" class="a5"> <img src="demo/CSS/img/100x100.png"> <span>3D右翻轉</span> </a> </div> <div class="div6"> <a href="###" class="a6"> <img src="demo/CSS/img/100x100.png"> <span>3D左翻轉</span> </a> </div> </section> </body> </html>
相關文章
- CSS3前後和左右翻轉效果CSSS3
- css3 3D 深度翻轉效果案例CSSS33D
- html 文字翻轉映象效果HTML
- CSS3多面體旋轉效果CSSS3
- CSS3星系旋轉效果代CSSS3
- CSS3圖片旋轉效果CSSS3
- CSS3旋轉載入等待效果CSSS3
- CSS3地月星系旋轉效果CSSS3
- CSS3旋轉風車效果程式碼CSSS3
- CSS3滑鼠懸浮div旋轉效果CSSS3
- CSS3旋轉效果程式碼例項CSSS3
- CSS3旋轉大風車效果詳解CSSS3
- CSS3滑鼠懸浮圖片前後翻轉CSSS3
- 滑鼠懸浮圖片實現翻轉效果
- div前後翻轉效果程式碼例項
- 使用css3做一個魔方旋轉的效果CSSS3
- CSS3立方體3D旋轉效果CSSS33D
- CSS3象棋效果CSSS3
- css3帶你實現3D轉換效果CSSS33D
- 簡單的css3頭像旋轉與3D旋轉效果CSSS33D
- 手寫一個使用css3旋轉硬幣的效果CSSS3
- CSS3 文字效果CSSS3
- CSS3 矩形切角效果CSSS3
- CSS3呼吸燈效果CSSS3
- CSS3空心圓效果CSSS3
- CSS3 checkbox美化效果CSSS3
- CSS3哭臉效果CSSS3
- html and css3 js製作翻頁書效果id1099-網頁前端設計HTMLCSSS3JS網頁前端
- 直播原始碼網站,實現文字自動翻轉效果原始碼網站
- CSS3箭靶效果程式碼CSSS3
- CSS3花屏文字效果CSSS3
- CSS3白鶴展翅效果CSSS3
- CSS3 loadding效果程式碼CSSS3
- CSS3 loadding載入效果CSSS3
- CSS3動畫效果下拉導航選單效果CSSS3動畫
- 高階UI特效之仿3D翻轉切換效果UI特效3D
- CSS基礎篇–CSS3圖片翻轉動畫技術詳解CSSS3動畫
- css3小球上下移動效果CSSS3