JSFiddle - React, Tailwind, and code Playground

HTML

<div class="middle-border">
  <img/>  
</div>

CSS

img {
  width: 80px;
  height: 80px;
  background: blue;
  display: block;
  margin: 0 auto;
  z-index: 2;
  position: relative;
}

.middle-border {
    position: relative;
    background: yellow;
    text-align: center;
}

.middle-border::before {
    content: "";
    display: block;
    height: 5px;
    background: red;
    width: 100%;
    position: absolute;
    z-index: 1;
    top: 50%;
    transform: translateY(-50%);
}