使用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>
相关推荐
杨超越luckly17 小时前
Agent应用指南:13年与13线——武汉地铁进化史
数据分析·html·agent·可视化·地铁客流
思码梁田18 小时前
CSS cursor 属性全解析:从“小手“开始,玩转鼠标光标
前端·css·计算机外设·cursor·pointer
黑土豆19 小时前
CSS 新特性:Container Queries 到底能解决什么痛点?
前端·css
思码梁田19 小时前
CSS vertical-align 属性详解:表格与图文对齐的实用指南
前端·css·vertical-align
葡萄城技术团队20 小时前
HTML元素单元格:用自定义 CellType 扩展 SpreadJS 的显示能力
前端·javascript·html
逝水无殇20 小时前
HTML 属性(HTML Attributes)详解
开发语言·前端·html·html5
用户059540174461 天前
把记忆存储的回归测试从手工换成 Playwright + GitHub Actions,线上缺陷降低 80%
前端·css
码农学院1 天前
2026年生成式搜索引擎优化对服务业本地化获客帮助的数字化转型路径
前端·搜索引擎·html
cll_8692418912 天前
一个好看的Wordpress博客文字css样式
前端·css·ui
三翼鸟数字化技术团队2 天前
一种前端大屏适配方案
前端·css