<div class="w300">
  <div class="w100"></div>
  <div class="w100 red"></div>
  <div class="w100"></div>
</div>

<div class="wrapper">
  <div class="item"></div>
  <div class="item red"></div>
  <div class="item"></div>
  <div class="item"></div>
  <div class="item red"></div>
</div>
.w300 {
  display: flex;
  width: 100%;
}

.w100 {
  width: 100px;
  height: 100px;
  background-color: #eee;
}

.wrapper {
  display: flex;
  flex-wrap: wrap;
  width: 300px;
}

.item {
  position: relative;
  box-sizing: border-box;
  width: 100px;
  height: 100px;
  background-color: #eee;
}

.item::after {
  position: absolute;
  box-sizing: border-box;
  top: -2.5px;
  left: -2.5px;
  content: '';
  width: calc(100% + 5px);
  height: calc(100% + 5px);
  border: 5px solid #000;
  pointer-events: none;
}

.red {
  background-color: #f99;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.