1. 程式人生 > >玩轉css3新特性 五角星

玩轉css3新特性 五角星

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>star</title>
</head>
<style>
.star{
width: 0;
height: 0;
border: 100px solid transparent;
border-bottom: 70px solid #f00;
border-left: 100px solid transparent;
margin: 100px auto;
transform: rotate(30deg);
position: relative;

}
.star::before{
content: "";
width: 0;
height: 0;
border-bottom: 80px solid red;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
position: absolute;
transform: rotate(-30deg);
top:-45px;
left: -65px;
}
.star::after{
content: "";
width: 0;
height: 0;
border-bottom: 70px solid red;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
position: absolute;
transform: rotate(-70deg);
top:3px;
left: -105px;
}
</style>
<body>
<div class="star"></div>
</body>
</html>