I need the length of the .divider
element to be equal to the length of the text (.topic
class) + 2em, so that divider is a bit longer than the text. Is this possible using CSS only (no JS)?
Here's the code (and JSFiddle):
<div class="divider"></div>
<div class="topic">
<div class="topic_symbols">@</div>
<div class="topic_text">THIS IS THE SAMPLE TEXT</div>
<div class="topic_symbols">@</div>
</div>
<div class="divider"></div>
.divider {
border-bottom: 2px solid #fdb239;
margin-left: 10%;
margin-right: 10%;
}
.topic {
display: flex;
font-family: Tahoma, Geneva, sans-serif;
justify-content: center;
align-items: center;
font-weight: 700;
font-size: calc(0.8em + 2.3vw);
}
.topic_symbols {
color: #ee290b;
}
.topic_text {
text-align: center;
color: #3cae3f;
margin: 1% 1em 1% 1em;
}