Short Lines Either Side Text
<p>Using CSS and HTML there are a load of answers for adding a line either side of some text but these lines always fill the full width of the container. I only want these lines to be 150px in length either side of the text like this:</p>

<p><a href="https://i.stack.imgur.com/4pZkk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4pZkk.jpg" alt="example of what the lines should look like"></a></p>

<p>The text will be dynamic so may change in length and needs to be centred.</p>

<p>Here is some jsfiddle code I have been working on:</p>

<p><a href="https://jsfiddle.net/vh0j4q1e/" rel="nofollow noreferrer">https://jsfiddle.net/vh0j4q1e/</a></p>

<pre><code>&lt;div id="container"&gt;
</code></pre>

<p><h1>TEXT HEADING</h1>
</p>

<pre><code>#container {
width:800px;
text-align:center;
background-color:#ccc;
}
h1 {
position: relative;
font-size: 30px;
z-index: 1;
overflow: hidden;
text-align: center;
}
h1:before, h1:after {
position: absolute;
top: 51%;
overflow: hidden;
width: 50%;
height: 3px;
content: '';
background-color: red;
}
h1:before {
margin-left: -50%;
text-align: right;
}
</code></pre>

<p>Can anyone help improve this code so the lines appear as per the image above? </p>