.angle{margin: 100px auto;width: 0;height: 0;border-top: 20px solid pink;border-right: 20px solid red;border-left: 20px solid blue;border-bottom: 20px solid orange;}
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{margin: 0;padding: 0;}.angle{margin: 100px auto;width: 0;height: 0;border-top: 20px solid pink;border-right: 20px solid red;border-left: 20px solid blue;border-bottom: 20px solid orange;}
</style>
</head>
<body>
<div class="angle"></div>
</body>
</html>
左侧三角形
效果:
样式:
.angle{margin: 100px auto;width: 0;height: 0;/* 四个边框设置为透明 */border: 20px solid transparent;/* 左侧设置边框样式 */border-left: 20px solid red;}