一. 三角形的製作
這裡採用的方法是利用border的上下左右邊框的收縮.
html部分
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>triangle</title>
</head>
<body>
<div class = 'triangle'>
</div>
</body>
</html>
複製程式碼
css部分
.triangle{
height:20px;
width:20px;
border-top:10px solid grey;
border-right:10px solid pink;
border-bottom:10px solid blue;
border-left:10px solid yellowgreen ;
}
複製程式碼
此時達到的效果如下


.triangle{
height:0px;
width:0px;
border-top:10px solid yellowgreen;
border-right:10px solid transparent;
border-bottom:10px solid transparent;
border-left:10px solid yellowgreen;
}
複製程式碼
大功告成
