HTML-CSS-182:3D转换模块

正方体代码

<!DOCTYPE html>

<html lang="en">

    <meta charset="UTF-8">

    <title>正方体

        *{

margin:0;

            padding:0;

        }

ul{

width:200px;

            height:200px;

            border:1px solid #000;

            margin:0 auto;

            margin-top:100px;

            font-size:100px;

            text-align:center;

            line-height:200px;

            position:relative;

            transform:rotateX(0deg)rotateY(0deg);

            transform-style:preserve-3d;

            /*perspective: 500px;*/

        }

ul li{

width:200px;

            height:200px;

            list-style:none;

            position:absolute;

            top:0;

            left:0;

        }

ul li:nth-of-type(1){

background-color:red;

            transform:rotateX(90deg)translateZ(100px);

        }

ul li:nth-of-type(2){

background-color:blue;

            transform:rotateX(180deg)translateZ(100px);

        }

ul li:nth-of-type(3){

background-color:green;

            transform:rotateX(270deg)translateZ(100px);

        }

ul li:nth-of-type(4){

background-color:yellow;

            transform:rotateX(360deg)translateZ(100px);

        }

ul li:nth-of-type(5){

background-color:purple;

            transform:rotateY(-90deg)translateZ(100px);

        }

ul li:nth-of-type(6){

background-color:orange;

            transform:rotateY(90deg)translateZ(100px);

        }

        <li>1

        <li>2

        <li>3

        <li>4

        <li>5

        <li>6

    </html>


    长方体代码

    <!DOCTYPE html>

    <html lang="en">

        <meta charset="UTF-8">

        <title>长方体

            *{

    margin:0;

                padding:0;

            }

    ul{

    width:200px;

                height:200px;

                /*border: 1px solid #000;*/

                margin:0 auto;

                margin-top:100px;

                font-size:100px;

                text-align:center;

                line-height:200px;

                position:relative;

                transform:rotateX(0deg)rotateY(0deg);

                transform-style:preserve-3d;

                /*perspective: 500px;*/

            }

    ul li{

    width:200px;

                height:200px;

                list-style:none;

                position:absolute;

                top:0;

                left:0;

            }

    ul li:nth-of-type(1){

    background-color:red;

                transform:rotateX(90deg)translateZ(100px)scaleX(2);

            }

    ul li:nth-of-type(2){

    background-color:blue;

                transform:rotateX(180deg)translateZ(100px)scaleX(2);

            }

    ul li:nth-of-type(3){

    background-color:green;

                transform:rotateX(270deg)translateZ(100px)scaleX(2);

            }

    ul li:nth-of-type(4){

    background-color:yellow;

                transform:rotateX(360deg)translateZ(100px)scaleX(2);

            }

    ul li:nth-of-type(5){

    background-color:purple;

                transform:rotateY(-90deg)translateZ(200px);

            }

    ul li:nth-of-type(6){

    background-color:orange;

                transform:rotateY(90deg)translateZ(200px);

            }

          <li>1

          <li>2

          <li>3

          <li>4

          <li>5

          <li>6

      </html>

      ©著作权归作者所有,转载或内容合作请联系作者
      平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

      推荐阅读更多精彩内容

      • 好的各位小伙伴 今天咱们来做一个 3D的旋转盒子 制作3D旋转盒子 老规矩,不要急着动手先来分析一波。先不管旋转,...
        Java联盟阅读 1,025评论 0 1
      • 好的各位小伙伴 今天咱们来做一个 3D的旋转盒子 制作3D旋转盒子 老规矩,不要急着动手先来分析一波。先不管旋转,...
        天诺IT技术阅读 950评论 0 1
      • transform transform:translate(x,y) /*向x轴或者y轴方向移动*/ transf...
        韦栋阅读 235评论 0 0
      • 一、CSS入门 1、css选择器 选择器的作用是“用于确定(选定)要进行样式设定的标签(元素)”。 有若干种形式的...
        宠辱不惊丶岁月静好阅读 1,644评论 0 6
      • 你不是你认为的那个你。文中通过两个孩子身份对换让我们理解他们的信念和观念,就是俗称的他们是谁,全部都是社会给...
        在水一方_y阅读 149评论 0 0