用css html帮我画个五角星和上一个不一样
时间: 2023-07-15 17:14:54 浏览: 60
CSS绘制五角星
5星 · 资源好评率100%
好的,请参考下面的代码:
```html
<div class="star">
<div class="inner"></div>
</div>
```
```css
.star {
width: 0;
height: 0;
border-bottom: 50px solid #f1c40f;
border-left: 35px solid transparent;
border-right: 35px solid transparent;
position: relative;
}
.star:before {
content: '';
position: absolute;
top: -20px;
left: -35px;
width: 0;
height: 0;
border-bottom: 30px solid #f1c40f;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
transform: rotate(35deg);
}
.star:after {
content: '';
position: absolute;
top: -20px;
right: -35px;
width: 0;
height: 0;
border-bottom: 30px solid #f1c40f;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
transform: rotate(-35deg);
}
.star .inner {
position: absolute;
top: -50px;
left: -35px;
width: 0;
height: 0;
border-bottom: 70px solid white;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
transform: rotate(180deg);
}
```
这段代码可以绘制一个黄色的五角星,与常见的五角星形状有所不同。
阅读全文