效果如图:
核心:使用伪类
代码如下: <div class="box-style"></div>
.box-style { position: relative; //纯css只有四个角有边框的样式 box-shadow: 0px 0px 12px 1px #003ba26b inset; background: linear-gradient(to left, #1f5fd3, #1f5fd3) left top no-repeat, linear-gradient(to bottom, #1f5fd3, #1f5fd3) left top no-repeat, linear-gradient(to left, #1f5fd3, #1f5fd3) right top no-repeat, linear-gradient(to bottom, #1f5fd3, #1f5fd3) right top no-repeat, linear-gradient(to left, #1f5fd3, #1f5fd3) left bottom no-repeat, linear-gradient(to bottom, #1f5fd3, #1f5fd3) left bottom no-repeat, linear-gradient(to left, #1f5fd3, #1f5fd3) right bottom no-repeat, linear-gradient(to left, #1f5fd3, #1f5fd3) right bottom no-repeat; background-size: 1px 11px, 11px 1px, 1px 11px, 11px 1px; } .box-style:before { content: ''; width: 0; height: 0; position: absolute; left: 0px; top: 5px; display: inline-block; border: 6px solid transparent; border-left-color: #003596; transform: rotate(225deg) translate3d(-1px, 8px, 0); transform-origin: 0%; } .box-style:after { content: ''; width: 0; height: 0; position: absolute; right: -20px; top: -2px; display: inline-block; border: 6px solid transparent; border-right-color: #003596; transform: rotate(138deg) translate3d(-1px, 8px, 0); transform-origin: 0%; }
标签:repeat,linear,no,gradient,1f5fd3,四边形,角是,css,left From: https://www.cnblogs.com/ruyijiang/p/17560104.html