So I have these titles that have horizontal lines to the left and right of them using CSS :before and :after.
The code looks like this:
.infoBlockA h1 {
line-height: normal;
color: #F6F6F6;
text-transform: uppercase;
letter-spacing: .5px;
text-decoration: none;
font-size: 200%;
text-align: center;
position: relative;
text-shadow: 1px 1px 0px #2c2e38, 2px 2px 0px #5c5f72;
}
.infoBlockA h1:before {
content: "";
margin: 15px 0px 0px 0px;
left: 0;
height: 2px;
position: absolute;
background: #DE1B1B;
}
.infoBlockA h1:after {
content: "";
right: 0;
margin: 15px 0px 0px 0px;
height: 2px;
position: relative;
background: #F6F6F6;
}
And then I normally set my width:
.infoBlockA h1:before,
.infoBlockA h1:after {
width:27%;
}
But since I have so many titles, I don't want have to set widths for every single title. How can I make the title squish the horizontal lines so that the lines are always a certain distance away from the text, but always fill the container they are in?
EDIT: To clarify, the titles are dynamic and are different lengths of text!