How can I show only corner borders?

后端 未结 16 1825
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 10:06

I\'m wondering if it\'s possible in CSS or jQuery to make a border but only for corner. Something like this:

****                         ****
*                     


        
16条回答
  •  爱一瞬间的悲伤
    2020-11-22 10:25

    You could absolutely position four

    s, one in each corner, each with the appropriate two borders.

    HTML

    content goes here

    CSS

    .corners {
      position: relative;
      width: 100px; /* for demo purposes */
      padding: 10px;
    }
    
    .top, .bottom {
      position: absolute;
      width: 10px;
      height: 10px;
    }
    
    .top {
      top: 0;
      border-top: 1px solid;
    }
    
    .bottom {
      bottom: 0;
      border-bottom: 1px solid;
    }
    
    .left {
      left: 0;
      border-left: 1px solid;
    }
    
    .right {
      right: 0;
      border-right: 1px solid;
    }
    

提交回复
热议问题