有关于css3的2d转换

css3中的2d转换在transform中写的东西是存在顺序关系的,比方说要把几张图片竖起来排成蜂窝状,就得先将图片旋转需要的角度,然后再在z轴上移动,否则反过来的话,就会变成整体先移动,然后再一个旋转需要的角度。
比方说下面所展示的部分的代码:

        img:nth-child(1){
            transform: translateZ(260px);
        }
        img:nth-child(2){
            transform: rotateY(60deg) translateZ(260px);
        }
        img:nth-child(3){
            transform: rotateY(120deg) translateZ(260px);
        }
        img:nth-child(4){
            transform: rotateY(180deg) translateZ(260px);
        }
        img:nth-child(5){
            transform: rotateY(240deg) translateZ(260px);
        }
        img:nth-child(6){
            transform: rotateY(300deg) translateZ(260px);
        }

正确效果是:这里写图片描述
如果将rotateY放到 translateZ后面,就变成了:这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq_42926749/article/details/82190954
今日推荐