JSFiddle - React, Tailwind, and code Playground

HTML

<h2><span>Your Title Goes Here</span></h2>

CSS

h2 {
    font-size: 24pt;
    position: relative;
    text-align: center;
}
h2 span {
    background-color: #fff;
    padding: 0 8px;
    z-index: 1;
    position: relative;
}
h2:before {
    position: absolute;
    content: '';
    left: 0px;
    right: 0px;
    top: 50%;
    border: 2px solid #eee;
    z-index: 0;
}