首頁 web前端 css教學 CSS3使用3D環境實現立體魔術方塊效果的實例代碼分享

CSS3使用3D環境實現立體魔術方塊效果的實例代碼分享

Oct 23, 2017 am 10:15 AM
css css3

CSS3使用3D環境實現立體魔術方塊效果的實例程式碼分享 

<!DOCTYPE html>
  <html>
  <head>
     <meta charset="UTF-8">
      <title>魔方</title>
      <style type="text/css">
          section{width: 100px;height:100px;border:5px solid red; margin:50px auto;padding:100px;perspective: 800px;}
          .box {width:100px;height:100px;position:relative;
              transform-style:preserve-3d;
             transition:4S;
             transform-origin:center center -50px;
         }
         .box div{width: 100px;height:100px;position:absolute;color:white;font-size:50px;text-align: center;line-height:100px;}
         .box div:nth-of-type(1){
             background: #FF6600;;
             transform:translateX(-100px) rotateY(-90deg);
             transform-origin:right;
         }
         .box div:nth-of-type(2){
             background:red ;
             transform:translateY(-100px) rotateX(90deg);
             transform-origin:bottom ;
                  }
         .box div:nth-of-type(3){
             background:darkviolet;
             transform:translateX(100px) rotateY(90deg);
             transform-origin:left;
         }
         .box div:nth-of-type(4){
             background:yellow;
             transform: translateY(100px) rotateX(-90deg) ;
             transform-origin:top;
         }
         .box div:nth-of-type(5){
             background:green;
             transform:translateZ(-100px) rotateY(180deg);
         }
         .box div:nth-of-type(6){
             background:blue;
         }
         section:hover .box{
             transform: rotateX(270deg) rotateY(-270deg) rotateX(-270deg) rotateY(270deg) ;
         }
     </style>
 </head>
 <body>
    <section>
         <div>
             <div>1</div>
             <div>2</div>
             <div>3</div>
             <div>4</div>
             <div>5</div>
             <div>6</div>
         </div>
     </section>
 </body>
  </html>
登入後複製

以上是CSS3使用3D環境實現立體魔術方塊效果的實例代碼分享的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱門文章

倉庫:如何復興隊友
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱門文章

倉庫:如何復興隊友
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱門文章標籤

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

vue中placeholder是什麼意思 vue中placeholder是什麼意思 May 07, 2024 am 09:57 AM

vue中placeholder是什麼意思

vue中空格怎麼寫 vue中空格怎麼寫 Apr 30, 2024 am 05:42 AM

vue中空格怎麼寫

vue中怎麼取得dom vue中怎麼取得dom Apr 30, 2024 am 05:36 AM

vue中怎麼取得dom

js中span是什麼意思 js中span是什麼意思 May 06, 2024 am 11:42 AM

js中span是什麼意思

js中rem是什麼意思 js中rem是什麼意思 May 06, 2024 am 11:30 AM

js中rem是什麼意思

vue中引入圖片的方法 vue中引入圖片的方法 May 02, 2024 pm 10:48 PM

vue中引入圖片的方法

span標籤的作用是什麼 span標籤的作用是什麼 Apr 30, 2024 pm 01:54 PM

span標籤的作用是什麼

瀏覽器插件是什麼語言寫的 瀏覽器插件是什麼語言寫的 May 08, 2024 pm 09:36 PM

瀏覽器插件是什麼語言寫的

See all articles