css3實現的紅心跳動效果

admin發表於2017-02-22
本章節分享一段程式碼例項,它實現了紅心跳動效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
.box {
  width: 180px;
  height: 160px;
  margin: 200px auto;
  position: relative;
  animation: shan .6s infinite alternate;
  text-align: center;
  -webkit-animation: shan .6s infinite alternate;
}
@-webkit-keyframes shan {
  0% {
    opacity: 0.5;
    -webkit-transform: scale(0.8,0.8);
    transform: scale(0.8,0.8);
  }
}
.box span {
  display: inline-block;
  background: #f06a73;
  position: absolute;
}
.box_lt, .box_rt {
  width: 100px;
  height: 100px;
  border-radius: 50%;
}
.box_lt {
  left: 0;
  top: 0;
}
.box_rt {
  left: 80px;
  top: 0;
}
.box_ft {
  width: 100px;
  height: 100px;
  -webkit-transform: rotate(135deg);
  left: 40px;
  top: 40px;
}
</style>
</head>
<body>
  <div class="box">
    <span class="box_lt"></span>
    <span class="box_rt"></span>
    <span class="box_ft"></span>
  </div>
</body>
</html>

相關文章