用html画一个睡觉的熊动画

html 复制代码
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>睡觉的熊动画</title>
  <link rel="stylesheet" href="./style.css">
</head>

<body>
  <div id="container">
    <div class="head"></div>
    <div class="muzzle"></div>
    <div class="ears"></div>
    <div class="body"></div>
    <div class="paws-front"></div>
    <div class="paws-back"></div>
    <div class="details"></div>
    <div class="tail"></div>

    <!-- zzz -->
    <div class="sleep">
      <span class="s1">z</span>
      <span class="s2">z</span>
      <span class="s3">z</span>
      <span class="s4">z</span>
      <span class="s5">z</span>
    </div>
  </div>
</body>

</html>
css 复制代码
body {
  background-color: #EBD8D0;
  text-align: center;
  height: 100%;
  margin: 0px;
}

#container {
  margin: 120px auto;
  position: relative;
  height: 230px;
  width: 754px;
}

#container div {
  position: absolute;
}

#container div::before,
#container div::after {
  content: '';
  position: absolute;
  display: block;
}


/* 头部 */

.head {
  z-index: 10;
  width: 152px;
  height: 70px;
  bottom: 32px;
  left: 143px;
  background: #A78A7F;
  border-radius: 100%;
}

.head:before {
  width: 122px;
  height: 122px;
  left: 54px;
  bottom: 0px;
  z-index: 199;
  background: #594a41;
  border-radius: 90% 50% 90% 90%;
  transform: rotateZ(226deg);
}

.muzzle {
  z-index: 5;
  width: 152px;
  height: 70px;
  bottom: 30px;
  left: 143px;
  background: #A78A7F;
  border-radius: 100%;
}


/* 耳朵 */

.ears {
  width: 42px;
  height: 42px;
  background: #594a41;
  border-radius: 100%;
  left: 220px;
  top: 60px;
  box-shadow: 34px -8px 0 0 #594a41
}


/* 身体 */

.body {
  width: 300px;
  height: 150px;
  background: #594a41;
  left: 228px;
  border-radius: 50%;
  bottom: 29px;
}


/* 前腿 */

.paws-front {
  z-index: 15;
  background: #A78A7F;
  width: 100px;
  height: 50px;
  bottom: 14px;
  left: 272px;
  border-radius: 80% 22% 55% 50% / 55% 22% 80% 50%;
  transform: rotateZ(12deg);
}


/* 后腿 */

.paws-back {
  width: 100px;
  height: 52px;
  border-top-left-radius: 100%;
  background: #A78A7F;
  left: 420px;
  bottom: 29px;
}

.paws-back:after {
  width: 36px;
  height: 52px;
  border-radius: 100%;
  left: 80px;
  background: #A78A7F;
}


/* 鼻子、腮红 */

.details {
  width: 25px;
  height: 25px;
  background: #221E22;
  border-radius: 100%;
  z-index: 20;
  box-shadow: 100px 0 0 #AD5D4E;
  bottom: 66px;
  left: 135px;
}


/* 眼睛 */

.details:after {
  width: 22px;
  height: 22px;
  border-bottom: 5px solid #221E22;
  border-top: 5px solid transparent;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-radius: 50%;
  left: 68px;
  top: -30px;
}


/* 尾巴 */

.tail {
  width: 50px;
  height: 50px;
  background: #594a41;
  border-radius: 100%;
  left: 490px;
  top: 60px;
}


/* 睡觉 zzz */

.sleep {
  height: 90px;
  width: 80px;
  position: absolute;
  left: 80px;
  top: 30px;
  font-size: 55px;
}

.sleep span {
  width: 15px;
  height: 15px;
  display: block;
  font-family: arial;
  font-weight: bold;
  text-align: center;
  line-height: 20px;
  background: #221E22;
  animation: zz 3s linear infinite;
}

.sleep .s1 {
  margin-left: 180px;
  margin-top: -40px;
}

.sleep .s2 {
  margin-left: 120px;
  margin-top: -5px;
}

.sleep .s3 {
  margin-left: 60px;
  margin-top: 5px;
}

.sleep .s4 {
  margin-left: 0px;
  margin-top: 12px;
}

.sleep .s5 {
  margin-left: -5px;
  margin-top: 52px;
}

@keyframes zz {
  0% {
    opacity: 0;
    transform: scale3d(.2, .2, .2) rotate(-20deg);
  }
  50% {
    opacity: 1;
  }
  80% {
    transform: translateY(-30px) translateX(20px) rotate(10deg);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
相关推荐
fruge1 小时前
Vue项目中的Electron桌面应用开发实践指南
前端·vue.js·electron
漂流瓶jz7 小时前
Webpack中各种devtool配置的含义与SourceMap生成逻辑
前端·javascript·webpack
前端架构师-老李7 小时前
React 中 useCallback 的基本使用和原理解析
前端·react.js·前端框架
musenh7 小时前
css样式学习
css·学习·css3
木易 士心7 小时前
CSS 中 `data-status` 的使用详解
前端·css
明月与玄武7 小时前
前端缓存战争:回车与刷新按钮的终极对决!
前端·缓存·回车 vs 点击刷新
牧马少女8 小时前
css 画一个圆角渐变色边框
前端·css
zy happy8 小时前
RuoyiApp 在vuex,state存储nickname vue2
前端·javascript·小程序·uni-app·vue·ruoyi
小雨青年8 小时前
Cursor 项目实战:AI播客策划助手(二)—— 多轮交互打磨播客文案的技术实现与实践
前端·人工智能·状态模式·交互
小光学长9 小时前
基于Vue的儿童手工创意店管理系统as8celp7(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
前端·数据库·vue.js