如何从角落删除边框的某些部分?
问题描述:
我要删除像这样的边框的角.
I want to remove the corners of borders like this picture.
答
您可以使用 :: before
和 :: after
伪元素来覆盖(因此,隐藏")边框的一部分:
You can use ::before
and ::after
pseudo elements to cover (and thus, "hide") parts of the border:
.bordery {
border: 1px solid teal;
padding: 20px;
position: relative;
}
.bordery::after,
.bordery::before {
background-color: white;
content: "";
display: block;
height: 10px;
position: absolute;
width: 10px;
}
.bordery::after {
bottom: -1px;
right: -1px;
}
.bordery::before {
top: -1px;
left: -1px;
}
<div class="bordery">This is just some sample content.</div>
>