一、三角形
.father {
width: 0px;
height: 0px;
border: 50px solid black;
}
.father {
width: 0px;
height: 0px;
border-top: 50px solid black;
border-right: 50px solid red;
border-bottom: 50px solid green;
border-left: 50px solid blue;
}
// transparent 关键字表示一个完全透明的颜色,即该颜色看上去将是背景色
.father {
width: 0px;
height: 0px;
border-top: 50px solid black;
border-right: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid transparent;
}
.caret {
width: 0;
height: 0;
border: 50px solid transparent;
border-top-color: black;
}
// 节省空间的三角形
.father {
width: 0px;
height: 0px;
border-top: 50px solid black;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
}
// 等腰梯形
.father {
width: 50px;
height: 0px;
border-top: 50px solid black;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
}
// 中空的图形
.father {
width: 50px;
height: 50px;
border-top: 50px solid black;
border-right: 50px solid red;
border-bottom: 50px solid green;
border-left: 50px solid blue;
}
// 平形四边形
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<style>
body {
margin: 0;
padding: 0;
}
.father1 {
position: relative;
width: 0;
height: 0;
border-top: 50px solid black;
border-right: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid transparent;
}
.father2 {
position: absolute;
top: -50px;
left: 50px;
width: 0;
height: 0;
border-top: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 50px solid green;
border-left: 50px solid transparent;
}
</style>
</head>
<body>
<div class="father1"></div>
<div class="father2"></div>
</body>
</html>