css实现中括号边框

要求:css + div 实现中括号边框

一、实现方式

    .square_brackets {
      border: none;
      position: relative;
      padding: 0;
      height: 130px;
      width: 400px;
    }

    .square_brackets:before,
    .square_brackets:after {
      content: '';
      display: block;
      height: 100%;
      width: 15px;
      border: 3px solid #979797;
      position: absolute;
      top: -2px;
    }

    .square_brackets:before {
      left: 0;
      border-right: 0;
    }

    .square_brackets:after {
      right: 0;
      border-left: 0;
    }

    .triangle {
      width: 0;
      height: 0;
      border: 10px solid;
      border-color: transparent #979797 transparent transparent;
      position: absolute;
      left: -17px;
      top: 50px;
    }

 

二、效果图

 

 

三、完整代码

完整代码下载

 

posted @ 2021-03-10 17:43  BillyYang  阅读(1028)  评论(0编辑  收藏  举报