1、html+css实现呼吸灯效果,如下图:
代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
body{
width: 100%;
height: 100%;
background-color: black;
}
.outer{
width: 150px;
height: 150px;
margin: 0 auto;
margin-top: 300px;
border-radius: 50%;
background-color: yellow;
box-shadow: yellow 0px 0px 80px ;
}
.inner{
float: left;
margin-left: -60px;
margin-top: -60px;
width: 500px;
height: 500px;
background-color: black;
opacity: 0.7;
animation-name: move;
animation-duration: 3s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@keyframes move{
from{
opacity: 0;
}
to{
opacity: 0.7
}
}
</style>
</head>
<body>
<div class="outer">
<div class="inner"></div>
</div>
</body>
</html>