<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>
.w300 {
  display: flex;
  width: 100%;
}

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

.wrapper {
  display: flex;
  width: 100%;
}

.item {
  box-sizing: border-box;
  width: 100px;
  height: 100px;
  background-color: #eee;
  border: 5px solid #000;
}

.item:first-child {
  border-right: 2.5px solid #000;
}

.item:last-child {
  border-left: 2.5px solid #000;
}

.item:not(:first-child):not(:last-child) {
  border-right: 2.5px solid #000;
  border-left: 2.5px solid #000;
}

.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.