前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >利用css3写一个旋转木马

利用css3写一个旋转木马

作者头像
大熊G
发布2022-11-14 16:53:06
6420
发布2022-11-14 16:53:06
举报
旋转木马.gif
旋转木马.gif

源代码如下

这里主要是使用css动画属性和3d旋转

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul,li{
            padding: 0;
            margin: 0;
            list-style: none;
        }
        body{
            perspective:1000px;
        }
        ul{
            position: relative;
            width: 200px;
            height:300px;
            margin:150px auto;
            transform-style: preserve-3d;
            animation: move 10s linear infinite;
        }
        li{
            position: absolute;
            top: 0;
            left: 0;
            width:200px;
            height:300px;
            
           
        }
        @keyframes move{
            0%{
                transform: rotateY(0);
            }
            100%{
                transform: rotateY(360deg);
            }
        }
        ul li:nth-child(1){
            transform:rotateY(0) translateZ(300px);
        }
        ul li:nth-child(2){
            transform:rotateY(60deg) translateZ(300px);
        }
        ul li:nth-child(3){
            transform:rotateY(120deg) translateZ(300px);
        }
        ul li:nth-child(4){
            transform:rotateY(180deg) translateZ(300px);
        }
        ul li:nth-child(5){
            transform:rotateY(240deg) translateZ(300px);
        }
        ul li:nth-child(6){
            transform:rotateY(300deg) translateZ(300px);
        }

        li img{
            width:200px;
            height:300px;
            
        }
    </style>
</head>
<body>
    <ul>
       
        <li>
            <img src="../h5css3/image/780.jfif" alt="">
        </li>
        <li>
            <img src="../h5css3/image/780.jfif" alt="">
        </li>
        <li>
            <img src="../h5css3/image/780.jfif" alt="">
        </li>
        <li>
            <img src="../h5css3/image/780.jfif" alt="">
        </li>
        <li>
            <img src="../h5css3/image/780.jfif" alt="">
        </li>
        <li>
            <img src="../h5css3/image/780.jfif" alt="">
        </li>
    </ul>
    <div>
        
    </div>   
</body>
</html>
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-11-03,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 源代码如下
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档