html + css制作小三角

22 阅读1分钟

最终效果 image.png

<!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>Document</title>
    <style>
        body{
            background-color: gray;
        }
        div{
            width: 0px;
            height: 0px;
            /* border-top:10px solid red; */
            border-bottom: 10px solid rgb(242, 247, 247);
            border-left: 10px solid transparent;
            border-right: 10px solid transparent;
        }
    </style>
</head>
<body>
    <div></div>
</body>
</html>