使用html画一颗五角星
<!DOCTYPE html>
<html>
<head>
<title>五角星</title>
<style>
.star {
position: relative;
width: 0;
height: 0;
margin: 50px auto;
border-right: 40px solid transparent;
border-bottom: 70px solid #f00;
border-left: 40px solid transparent;
transform:rotate(35deg);
animation:rotate 3s infinite linear;
}
<pre><code> .star:before {
content: "";
position: absolute;
top: -50px;
left: -40px;
width: 0;
height: 0;
border-right: 40px solid transparent;
border-bottom: 70px solid #f00;
border-left: 40px solid transparent;
transform: rotate(-35deg);
}
.star:after {
content: "";
position: absolute;
top: -50px;
left: -40px;
width: 0;
height: 0;
border-right: 40px solid transparent;
border-bottom: 70px solid #f00;
border-left: 40px solid transparent;
transform: rotate(105deg);
}
@keyframes rotate {
100% {
transform:rotate(395deg);
}
}
</style>
</code></pre>
</head>
<body>
<div class="star"></div>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/8VH 著作权归作者所有。请勿转载和采集!