<!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: &quot;&quot;;
	  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: &quot;&quot;;
	  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);
	  }
	}
&lt;/style&gt;
</code></pre>
</head>
<body>
	<div class="star"></div>
</body>
</html>
使用html画一颗五角星

原文地址: https://www.cveoy.top/t/topic/8VH 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录