用CSS画三角形:须将元素的width, height, padding均设置为0, 靠border的重叠覆盖来画三角形,代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>CSS画三角形</title>
<style style="text/html">
#ss{
width: 0px;
height: 0px;
border-width: 40px;
border-style: solid;
border-top-color: green;
border-left-color: red;
border-right-color: pink;
border-bottom-color: black;
}
</style>
</head>
<body>
<div id="ss"></div>
</body>
</html>