DIV+CSS 伪元素实现表头斜线

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <style>
        #star-six {
            width: 100px;
            height: 100px;
            border: 1px solid black;
            position: relative;
        }


            #star-six::before {
                position: absolute;
                top: 0;
                right: 0;
                left: 0;
                bottom: 0;
                border-bottom: 100px solid #000;
                border-left: 99px solid transparent;
                content: "";
            }


            #star-six::after {
                position: absolute;
                left: 1px;
                right: 0;
                top: 1px;
                bottom: 0;
                border-bottom: 99px solid #fff;
                border-left: 98px solid transparent;
                content: "";
            }
    </style>
</head>
<body>
    <div id="star-six"></div>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/luochenlong/article/details/79032448