CSS Inset Borders

前端 未结 12 1663
没有蜡笔的小新
没有蜡笔的小新 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:38

    If box-sizing is not an option, another way to do this is just to make it a child of the sized element.

    Demo

    CSS

    .box {
      width: 100px;
      height: 100px;
      display: inline-block;
      margin-right: 5px;
    }
    .border {
      border: 1px solid;
      display: block;
    }
    .medium { border-width: 10px; }
    .large  { border-width: 25px; }
    


    HTML

    A
    B
    C

提交回复
热议问题