小星星制作css3

```

原理:一个正方形 两个圆 定位 旋转 圆角边属性 

body部分

<body>
<div class="heart-body">
<!--:before-->
<div class="heart-shape"></div>
<!--:after-->
</div>
</body>
css部分


.heart-body{
width: 200px;
height: 200px;
left: 50%;
top: 50%;
margin: 10px auto;
background: red;
position: absolute;
transform: rotate(45deg);
animation: love 1s ease infinite;
}
.heart-shape{
width: 200px;
height: 200px;
background: indianred;
box-shadow: 0 0 50px rgb(255,0,0);
}
.heart-body:before{
content:'';
width: 200px;
height: 200px;
background: indianred;
border-radius: 50%;
box-shadow: 0 0 50px rgb(255,0,0);
position: absolute;
top: 0;
left: -100px;
}
.heart-body:after{
content:'';
width: 200px;
height: 200px;
background: indianred;
border-radius: 50%;
box-shadow: 0 0 50px rgb(255,0,0);
position: absolute;
top: -100px;
left: 0px;
}
@keyframes love {
0%,100%{transform: scale(0.9,0.9)rotate(45deg)}
50%{transform: scale(1.2,1.2)rotate(45deg)}
}

```

猜你喜欢

转载自www.cnblogs.com/xieting123/p/9638364.html