您的位置:首页 > Web前端 > CSS

CSS——三角形

2017-11-06 14:15 183 查看
<!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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: