• 2019-11-23

    Inset image border

    Comments

    Start a discussion

    It's not as simple as it seems to make an inset image border. We need a container element as well as a pseudo element for it to work.

    figure {
      position: relative;
      display: flex;
    }
    
    figure:before {
      content: '';
      border: 1rem solid red;
      width: 100%;
      height: 100%;
      position: absolute;
      box-sizing: border-box;
    }