使用css实现旋转木马HTML

使用css实现旋转木马HTML

效果图

实现代码如下

html 复制代码
<!DOCTYPE html>
<html lang="zh-cn">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>旋转木马</title>
  <style>
    .div {
      width: 200px;
      height: 300px;
      /* border: 1px solid red; */
      margin: 300px auto;
      position: relative;
      /* perspective: 1000px; */
      transform-style: preserve-3d;
      transform: rotateX(-10deg);
      animation: move 30s linear infinite;
      /* transition: all 5s; */
      color: deeppink;

      background-image: url(./img/07.webp);
      background-repeat: no-repeat;
      background-position: center;
      background-size: 100% 100%;
    }

    .div div {
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
    }

    .div div span img {
      width: 100%;
      height: 100%;
      position: absolute;
    }

    .div div:nth-child(1) {
      background-image: url(./img/01.webp);
      background-repeat: no-repeat;
      background-position: center;
      background-size: 100% 100%;
      /* background-color: aqua; */
      transform: translateZ(500px);
    }

    .div div:nth-child(2) {
      background-image: url(./img/02.webp);
      background-repeat: no-repeat;
      background-position: center;
      background-size: 100% 100%;
      /* background-color: red; */
      transform: rotateY(60deg) translateZ(500px);
    }

    .div div:nth-child(3) {
      background-image: url(./img/03.webp);
      background-repeat: no-repeat;
      background-position: center;
      background-size: 100% 100%;
      /* background-color: pink; */
      transform: rotateY(120deg) translateZ(500px);
    }

    .div div:nth-child(4) {
      background-image: url(./img/04.webp);
      background-repeat: no-repeat;
      background-position: center;
      background-size: 100% 100%;
      /* background-color: blue; */
      transform: rotateY(180deg) translateZ(500px);
    }

    .div div:nth-child(5) {
      background-image: url(./img/05.webp);
      background-repeat: no-repeat;
      background-position: center;
      background-size: 100% 100%;
      /* background-color: purple; */
      transform: rotateY(-120deg) translateZ(500px);
    }

    .div div:nth-child(6) {
      background-image: url(./img/06.webp);
      background-repeat: no-repeat;
      background-position: center;
      background-size: 100% 100%;
      /* background-color: brown; */
      transform: rotateY(-60deg) translateZ(500px);
    }

    @keyframes move {
      to {
        transform: rotateX(-10deg) rotateY(360deg);
      }
    }

    audio {
      display: none;
    }
  </style>
</head>

<body>
  <div class="div">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
  </div>
</body>

</html>
相关推荐
禁默6 小时前
【学术投稿-2025年计算机视觉研究进展与应用国际学术会议 (ACVRA 2025)】从计算机基础到HTML开发:Web开发的第一步
前端·计算机视觉·html
CaptainDrake8 小时前
CSS Module 常用笔记
css·笔记·tensorflow
暗暗那10 小时前
【腾讯前端面试】纯css画图形
前端·css·面试
大模型铲屎官10 小时前
深入剖析 HTML5 新特性:语义化标签和表单控件完全指南
前端·html·编程·html5·语义化标签·表单控件
桂月二二12 小时前
深入探讨前端新技术:CSS Container Queries 的应用与实践
前端·css
小郑T_T12 小时前
BEM规范
前端·css·vue.js
大美B端工场-B端系统美颜师12 小时前
站在JavaScript的视角去看,HTML的DOM和GLTF的Json数据。
javascript·html·json·gltf
大模型铲屎官16 小时前
前端表单验证终极指南:HTML5 内置验证 + JavaScript 自定义校验
前端·javascript·html·html5·表单验证·内置验证·自定义校验
荆州克莱20 小时前
利用Docker简化机器学习应用程序的部署和可扩展性
spring boot·spring·spring cloud·css3·技术
ufosuai5551 天前
HTML基本语法
前端·html