I have centered heading text in a container, and I am using a border-bottom and pseudo element to create an underline effect. However, I am uncertain about how to make the underline stop at the end of the heading text.
https://i.sstatic.net/FseHl.png
Here is my code:
.headerWrap {
background: #0a1633;
position: relative;
}
/* Attempting to use this to mask the overflow */
.headerWrap:after {
position: absolute;
display: block;
content: "";
bottom: 0;
left: 65%;
right: 0;
border-bottom: 10px solid #0a1633;
}
.header {
margin: 0 auto 24px;
text-align: center;
font-weight: bold;
position: relative;
padding-bottom: 10px;
color: #ff6347;
border-bottom: 2px solid #ff6347;
position: relative;
}
.header:before {
position: absolute;
right: 0;
bottom: 0;
left: 0;
display: block;
margin-bottom: 2px;
content: "";
border-bottom: 6px solid #ff6347;
}
<div class="headerWrap">
<h3 class="header">Header</h3>
</div>