前端学习代码实例-CSS3心形效果代码

利用css3实现了日食效果。

代码实例如下:

《前端学习代码实例-CSS3心形效果代码》

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>web前端开发学习q群:731771211   技术分享,欢迎基础小伙伴</title>
<style>
* {
  margin: 0;
  padding: 0;
}
body {
  background: #222;
}
.sky {
  position: relative;
  padding-top: 15px;
  width: 800px;
  height: 600px;
  margin: 150px auto;
}
.moon {
  margin: 0 auto;
  width: 200px;
  height: 200px;
  background-color: #f3f3f3;
  border-radius: 50%;
  box-shadow:6px 6px 10px #666, 6px -6px 10px #666, -6px 6px 10px #666, -6px -6px 10px #666;
}
.dog {
  position: absolute;
  top: 15px;
  left: 90px;
  width: 200px;
  height: 200px;
  background-color: #222;
  border-radius: 50%;
  animation: dogEatMoon 8s ease-out infinite;
}
@keyframes dogEatMoon {
  0% {
    left: 90px;
  }
  35% {
    left: 300px;
  }
  55% {
    left: 300px;
  }
  100% {
    left: 520px;
  }
}
</style>
</head>
<body>
  <div class="sky">
    <div class="moon"></div>
    <div class="dog"></div>
  </div>
</body>
</html>

    原文作者:IT智云编程
    原文地址: https://www.jianshu.com/p/d9915047f2d1
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞