4
I’ll leave an example that will work for all cases, with any sentence size (as many words as you want), or with any font-size
, or even in a <h1>
or <p>
Notice I put the p
and the hr
within a container
with display:flex
, this will leave the elements side by side horizontal, then I put flex:1
in the hr
, this will make it grow and occupy only the remaining space of the width of the container
.
.meu-hr {
display: flex;
align-items: center;
}
.meu-hr hr {
flex:1;
border-color: red;
margin-left: .5em;
}
<div class="meu-hr">
<p>123</p><hr>
</div>
<div class="meu-hr">
<h1>123456</h1><hr>
</div>
<div class="meu-hr">
<p style="font-size:40px">123456789</p><hr>
</div>
Could you describe what the expected result would be? If possible, add an image illustrating what you need. By the way, in the title there is twice the tag
<hr>
.– Woss
@woss I put, thank you
– Amadeu Antunes
Amadeu, what should happen if the
<p>
have more than one line?– Woss
@Woss in this case will be something fixed
– Amadeu Antunes