CSS装飾枠線例



ないよう

▼HTML

<div class="css-border">
    <b class="css-border1"><b></b></b>
    <b class="css-border2"><b></b></b>
    ないよう
</div>

▼CSS

.css-border {
    background: #fff;
    padding: 50px 0;
    position: relative;
}
.css-border1,
.css-border2 {
    position: absolute;
    box-sizing: border-box;
    overflow: hidden;
}
.css-border1:before,
.css-border1:after,
.css-border1 b:before,
.css-border1 b:after,
.css-border2:before,
.css-border2:after,
.css-border2 b:before,
.css-border2 b:after {
    content: '';
    display: block;
    background: #fff;
    border-radius: 50%;
    position: absolute;
}
.css-border1 {
    left: 7px;
    right: 7px;
    top: 7px;
    bottom: 7px;
    box-shadow: 0 0 0 1px #f66 inset;
}
.css-border1:before,
.css-border1:after,
.css-border1 b:before,
.css-border1 b:after {
    width: 32px;
    height: 32px;
    box-shadow: 0 0 0 1px #f66;
}
.css-border1:before {
    left: -19px;
    top: -19px;
}
.css-border1:after {
    right: -19px;
    top: -19px;
}
.css-border1 b:before {
    left: -19px;
    bottom: -19px;
}
.css-border1 b:after {
    right: -19px;
    bottom: -19px;
}
.css-border2 {
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    box-shadow: 0 0 0 3px #f66 inset;
}
.css-border2:before,
.css-border2:after,
.css-border2 b:before,
.css-border2 b:after {
    width: 28px;
    height: 28px;
    box-shadow: 0 0 0 3px #f66;
}
.css-border2:before {
    left: -14px;
    top: -14px;
}
.css-border2:after {
    right: -14px;
    top: -14px;
}
.css-border2 b:before {
    left: -14px;
    bottom: -14px;
}
.css-border2 b:after {
    right: -14px;
    bottom: -14px;
}