CSS Inset Borders

前端 未结 12 1642
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 15:26

I need to create a solid color inset border. This is the bit of CSS I\'m using:

border: 10px inset rgba(51,153,0,0.65);

Unfortunately that cr

12条回答
  •  有刺的猬
    2020-12-02 15:53

    It's an old trick, but I still find the easiest way to do this is to use outline-offset with a negative value (example below uses -6px). Here's a fiddle of it—I've made the outer border red and the outline white to differentiate the two:

    .outline-offset {
    width:300px;
    height:200px;
    background:#333c4b;
    border:2px solid red;
    outline:2px #fff solid;
    outline-offset:-6px;
    }
    
    

提交回复
热议问题