您可以使用、和<div>类创建4 。使它们是绝对的,容器是相对的。调整它们的大小,使它们成为容器 bg-color 的颜色,并将它们带到具有属性的角落。它们的值必须减去边框宽度。这是具有 3px 边框的元素示例:.top-left.top-right.bottom-left.bottom-righttop, right, bottom and left
HTML:
<div class="box">
    <div class="corner top-left"></div>
    <div class="corner top-right"></div>
    <div class="corner bottom-left"></div>
    <div class="corner bottom-right"></div>
</div>
CSS:
.box{
    width: 300px;
    height: 300px;
    border: 3px solid #666;
    position:relative; 
}
.corner{
    width: 10px;
    height: 10px;
    background-color: #fff; 
    position: absolute;
}
.top-left{
    top: -3px;
    left: -3px;
}
.top-right {
    top: -3px;
    right: -3px;
}
.bottom-left{
    bottom: -3px;
    left: -3px;
}
.bottom-right{
    bottom: -3px;
    right: -3px;
}