JSFiddle - React, Tailwind, and code Playground

HTML

<div class="content">
  <h1><div class="heading">Heading</div></h1>
  <h1><div class="heading">Overflowing Heading Overflowing Heading Overflowing Heading Overflowing Heading</div></h1>
</div>

CSS

body {
    text-align: center;
    background: #eee;
    font-family: sans-serif;
}
.content {
    width: 80%;
    background: white;
    margin: auto;
    padding: 10px;
}
h1 {
    text-align: center;
    overflow: hidden;
    font-size: 16px;
}
.heading {
    display: inline-block;
    position: relative;
    max-width: 80%;
}
.heading:before {
    right: 100%;
}
.heading:after {
    left: 100%;
}
.heading:after, .heading:before {
    content:"";
    width: 100000px;
    height: 2px;
    position: absolute;
    margin: 0 5px;
    background: #777;
    top: 50%;
    margin-top: -1px;
}