css绘制三角形 triangle
文章目录
效果图
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>css绘制三角形</title>
<style>
.box{
display:flex;
}
.box div:not(:last-child){
margin-right: 20px;
}
.triangle{
border-style: solid;
border-color:transparent;
border-top-color:#f00;
border-width: 25px;
height:0;
width:0;
}
.triangle2{
border-style: solid;
border-color:transparent;
border-top-color:#f00;
border-top-width: 50px;
border-left-width: 25px;
border-right-width: 25px;
height:0;
width:0;
}
.triangle3{
border-style: solid;
border-color:transparent;
border-top-color:#f00;
border-top-width: 50px;
border-left-width: 32px;
border-right-width: 32px;
height:0;
width:0;
}
</style>
</head>
<body>
<div class="box">
<div class="triangle"></div>
<div class="triangle2"></div>
<div class="triangle3"></div>
</div>
</body>
</html>