如果利用border设置四周的border,如果一边的边框比较长无法对齐
解决办法:
.test{ position: relative; border: 1px solid #808080; height: 100px; 100px; } .test:after{ content: ''; position: absolute; right: -10px; top:-1px; 0; height: 0; border- 102px 10px 0 0; border-style: solid; border-color:red; } <div class="test"> </div>