<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
#d1 {
width: 0; /* 一定要定义宽高 */
height: 0;
border: 8px solid transparent; /* 透明 */
border-top: 8px solid red;
}
#d2 {
width: 0;
height: 0;
border: 8px solid transparent;
border-right: 8px solid red;
}
#d3 {
width: 0;
height: 0;
border: 8px solid transparent;
border-bottom: 8px solid red;
}
#d4 {
width: 0;
height: 0;
border: 8px solid transparent;
border-left: 8px solid red;
}
#d5 {
width: 0;
height: 0;
border-top: 8px solid red;
border-right: 8px solid blue;
border-bottom: 8px solid green;
border-left: 8px solid black;
}
</style>
</head>
<body>
<div id="d1"></div><hr/>
<div id="d2"></div><hr/>
<div id="d3"></div><hr/>
<div id="d4"></div><hr/>
<div id="d5"></div>
</body>
</html>
CSS——三角形
最新推荐文章于 2024-01-31 17:42:20 发布