css三角

<!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>
        .jd {
            position: relative;
            width: 100px;
            height: 100px;
            background-color: cornflowerblue;
            margin: 100px auto;
        }

        .square {
            position: absolute;
            top: -40px;
            left: 30px;
            width: 0;
            height: 0;
            border: 20px solid transparent;
            border-bottom-color: cornflowerblue;
        }
    </style>
</head>
<body>
        <div class="jd">
            <div class="square"></div>
        </div>
    </div>
</body>
</html>

posted @ 2020-08-16 21:38  珊迪·奇克斯  阅读(91)  评论(0)    收藏  举报