給盒子左上和右下加邊框角

給盒子左上和右下加邊框角

在這裏插入圖片描述

<!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>
        .box {
            width: 320px;
            height: 300px;
            box-shadow: 0 0 200px 200px rgba(0, 0, 255, 0.1) inset;
            position: relative;
        }
        
        .box:after {
            content: "";
            display: block;
            width: 20px;
            height: 20px;
            border-left: 2px solid blue;
            border-top: 2px solid blue;
            position: absolute;
            left: -1px;
            top: -1px;
        }
        
        .box:before {
            content: "";
            display: block;
            width: 20px;
            height: 20px;
            border-right: 2px solid blue;
            border-bottom: 2px solid blue;
            position: absolute;
            right: -1px;
            bottom: -1px;
        }
    </style>
</head>


<body>
    <div class="box"></div>
</body>

</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章