3차원 루빅스 큐브 효과를 달성하기 위해 3D 환경을 사용하는 CSS3의 예제 코드 공유

黄舟
풀어 주다: 2017-10-23 10:15:44
원래의
2250명이 탐색했습니다.

CSS3는 3D 환경을 사용하여 3차원 루빅스 큐브 효과 예제 코드 공유를 구현합니다.

<!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>
로그인 후 복사

위 내용은 3차원 루빅스 큐브 효과를 달성하기 위해 3D 환경을 사용하는 CSS3의 예제 코드 공유의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!