使用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>
相关推荐
Han.miracle43 分钟前
JavaScript 基础核心知识点闯关练习
css·js
韩曙亮43 分钟前
【Web APIs】移动端常用的 JavaScript 开发插件 ⑤ ( Swiper 插件案例 - 3D 木马特效 )
前端·javascript·css·html·swiper·web apis
松涛和鸣1 小时前
DAY 44 HTML and HTTP Server Interaction Notes
linux·前端·网络·数据库·http·sqlite·html
冥界摄政王1 小时前
CesiumJS学习第四章 替换指定3D建筑模型
3d·vue·html·webgl·js·cesium
0思必得011 小时前
[Web自动化] Requests模块响应的内容
运维·前端·python·自动化·html·web自动化
我爱娃哈哈17 小时前
SpringBoot集成:5分钟实现HTML转PDF功能
spring boot·pdf·html
低代码布道师18 小时前
互联网医院18:前端进阶——CSS“父相子绝”打造专业级卡片交互
前端·css·低代码·小程序·云开发
ヤ鬧鬧o.18 小时前
导航菜单实现平滑切换页面
javascript·css·html
luffy545918 小时前
css实现五星好评样式
前端·css·html
松涛和鸣19 小时前
DAY43 HTML Basics
linux·前端·网络·网络协议·tcp/ip·html