CSS double border (2 colors) without using outline?

前端 未结 7 977
小鲜肉
小鲜肉 2020-12-03 14:07

I was wondering what you guys think is the easiest way to get a double border with 2 colors around a div? I tried using border and outline together and it worked in Firefox

7条回答
  •  鱼传尺愫
    2020-12-03 15:03

    With box-shadow you can achieve as many different color borders as you want. E.g:

    #mydiv{
      height: 60px;
      width: 60px;
      box-shadow: inset 0 0 0 5px #00ff00, inset 0 0 0 10px #0000ff;
    }
    
    
     

    https://jsfiddle.net/aruanoc/g5e5pzny

提交回复
热议问题