CSS实现三角形

29 阅读1分钟
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS实现三角形</title>
    <style>
        #tr1{
            width:0;
            height:0;
            border-top: 50px solid skyblue;
            border-right:50px solid transparent;
            border-left:50px solid transparent;
        }
        #tr2{
            border-style:solid;
            border-color:transparent;
            border-width:50px 0 50px 50px;
            border-left-color:skyblue;
        }
        #tr3{
            width:0;
            height:0;
            border-left:69px solid transparent;
            border-right:69px solid transparent;
            border-bottom:120px solid skyblue;
        }
    </style>
</head>
<body>
    <div id ="tr1"></div>
    <div id ="tr2"></div>
    <div id ="tr3"></div>
</body>
</html>