首頁 > web前端 > css教學 > 主體

html實現3d懸浮效果的實現步驟

php中世界最好的语言
發布: 2017-11-29 14:56:35
原創
3306 人瀏覽過

實現3d懸浮效果是要使用H5的新屬性,要怎麼達成3d懸浮效果?實現3d懸浮效果的注意事項有哪些,下面就是實戰案例,一起來看一下。

<!DOCTYPE html>
<html>
         <head>
                   <meta charset="UTF-8">
                   <title></title>
                   <style>
                            *{margin: 0; padding: 0;}
                            ul,li{list-style: none;}
                            .container{perspective: 1300;-webkit-perspective:1300;}
                            .boxList{position:absolute;width: 630px;height:630px;left:50%;margin-left:-315px; -webkit-transform-style: preserve-3d;transform-style: preserve-3d;/*animation: a1 2s 1;*/transition: all 2s;}
                            .boxList li{float: left;width: 200px;height: 200px;margin:5px;background: darkcyan;-webkit-transition: all 0.3s;transition: all 0.3s;}
                            .on li:hover{-webkit-transform: translate3d(0,0,30px);transform: translate3d(0,0,30px);background:deepskyblue;box-shadow: 30px 30px 10px rgba(0, 0, 0, 0.5);}
                            .on{webkit-transform: rotateX(75deg) rotateY(0deg) rotateZ(45deg);transform: rotateX(75deg) rotateY(0deg) rotateZ(45deg);}
                   </style>
         </head>
         <body>
                   <div>
                            <ul>
                                     <li></li>
                                     <li></li>
                                     <li></li>
                                     <li></li>
                                     <li></li>
                                     <li></li>
                                     <li></li>
                                     <li></li>
                                     <li></li>
                            </ul>
                   </div>
         </body>
         <script>
                   var list=document.querySelector(&#39;.boxList&#39;);
                   window.onload=function(){
                            setInterval(transition,1000)
                           
                   }
                   function transition(){
                            list.className=&#39;on boxList&#39;;
                   }
         </script>
</html>
登入後複製


相信看了這些案例你已經掌握了方法,更多精彩請關注php中文網其它相關文章!

相關閱讀:

如何用CSS做圖片旋轉效果

#HTML裡無法顯示背景顏色的解決方法

Js操作DOM物件的流程


#

以上是html實現3d懸浮效果的實現步驟的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!