I have a before and after pseudo element for articleSubTitle. I am running into an issue when I have a small container or on mobile devices where the text from articleSubTitle falls to a new line. What this is causing is the after element to fall right after the last word (see snippet).
What I am wanting is for the articleSubTitle to be a whole element and the before and after elements to be placed always in the middle of it, despite how long it may be. I'd post an image, but the uploader keeps failing to upload it.
I have tried making articleSubTitle display:block and display:inline-block. Neither of these attempts has helped.
Does anyone know how I can accomplish this?
.container {
width: 70%;
background: gray;
}
.articleSubTitle {
font-family: 'Nunito', sans-serif;
font-size: 1.3rem;
color: #4d4d4d;
}
.articleSubTitle:before,
.articleSubTitle:after {
content: '';
display: inline-block;
vertical-align: middle;
width: 70px;
height: 1px;
background: #2f2f2f;
}
.articleSubTitle:before {
margin-right: 10px;
}
.articleSubTitle:after {
margin-left: 10px;
}
<div class="container">
<h4 class="articleSubTitle center">From the company A & the company B</h4>
</div>