How can I show only corner borders?

后端 未结 16 1642
被撕碎了的回忆
被撕碎了的回忆 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:30

    Here is a modified version of the above answer, this version has relative positioned parent and absolute positioned child so we can add the on hover effect.

    http://jsfiddle.net/3jo5btxd/

    HTML:
    
    CSS: #div1 { position: relative; height: 100px; width: 100px; background-color: white; border: 1px solid transparent; } #div2 { position: absolute; top: -2px; left: -2px; height: 84px; width: 84px; background-color: #FFF; border-radius: 15px; padding: 10px; } #div1:hover { border: 1px solid red; }

提交回复
热议问题