Currently, I'm working on adding a subtle border under the headlines of a website. My method involves utilizing before and after pseudo-elements in the code. The challenge lies in customizing the template code to achieve this effect. You can take a look at the code here.
An issue I've encountered is with the "left: 48%;" property which I have manually set. Depending on the screen size, the alignment may not be optimal, making it non-responsive. Is there a way to ensure that the border always stays centered beneath the text?
.headline p:before,
.headline p:after {
position: absolute;
left: 48%;
display: block;
width: 70px;
border-bottom: 3px solid black;
content: "";
}
h3 {
text-align: center;
}
<div class="headline">
<h3>
My title
</h3>
<p>
</p>
</div>