1.三角形
.shape {
width: 0;
height: 0;
border-top: 100px solid rgba(0, 0, 0, 0);
border-right: 100px solid rgba(0, 0, 0, 0);
border-bottom: 100px solid blue;
border-left: 100px solid rgba(0, 0, 0, 0);
}
使用border属性实现。宽高设置为0,border里其中一个方向设置为想要的颜色,其他的设置为完全透明的颜色。
2. 正方形
.shape {
width: 100px;
height: 100px;
background-color: lightcoral;
}
正方形都会画,纯属占个位子。。
3. 五边形
.shape {
width: 100px;
height: 100px;
background-color: blue;
clip-path: polygon(50% 0%, 1