继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

CSS3 基础之 旋转的发光盒

纯情掉了一地
关注TA
已关注
手记 33
粉丝 30
获赞 84


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #box{
            margin-left: 100px;
 margin-top: 100px;
 width: 400px;
 height: 400px;
 perspective: 500px;
 background: #000;
 }
        @keyframes rotateDoor{
            100%{transform: rotateY(360deg)}
        }
        .door{
            width: 100%;
 height: 100%;
 position: relative;
 animation: rotateDoor 10s linear infinite;
 transform-style:preserve-3d;
 }
        .item{
            width: 100px;
 height: 100px;
 background: rgba(74, 141, 193, 0.62);
 margin-top: 150px;
 margin-left: 150px;
 position: absolute;
 border:5px solid #ffffff;
 border-radius: 5px ;
 box-shadow: 0 0 50px #ffffff;
 }
        .item:nth-child(1){ transform: translateZ(50px);}
        .item:nth-child(2){ transform: rotateY(90deg) translateZ(50px);}
        .item:nth-child(3){ transform: rotateY(180deg) translateZ(50px);}
        .item:nth-child(4){ transform: rotateY(270deg) translateZ(50px);}
    </style>
</head>
<body>
<div id="box">
    <div class="door">
        <div class="item"></div>
        <div class="item"></div>
        <div class="item"></div>
        <div class="item"></div>
    </div>
</div>
</body>
</html>

https://img4.mukewang.com/5b1fe3170001a5f204890431.jpg


preserve-3d:维持3d效果  preserve:维持
perspective:透视
多变形效果 空格分割 变形效果优先于空间位移效果


打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP