css用border画出一个三角形
用border制作三角形
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.box{
width: 0;
height: 0;
/*boder-top 角向下 ,border-bottom 角向上*/
border-top: 20px solid red;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
显示结果: