Incorporating bootstrap 4.6 and flexbox into my design, I am facing an issue with a horizontal line not filling the space between two other div elements.
When the text is short, everything aligns as expected. However, when the text extends to two lines, there is extra space and insufficient room for the line to display properly.
How can I resolve this problem?
https://i.sstatic.net/3Wtr6.jpg
.title, .price {
border: 1px dotted #777;
}
.line {
border-top: 2px dotted black;
margin: 0 20px;
flex: 1;
align-self: center;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" integrity="sha512-P5MgMn1jBN01asBgU0z60Qk4QxiXo86+wlFahKrsQf37c9cro517WzVSPPV1tDKzhku2iJ2FVgL67wG03SGnNA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<div class="d-flex mt-5">
<div class="title">
<h1>Some text</h1>
</div>
<div class="line">
</div>
<div class="price">
$99
</div>
</div>
<div class="d-flex mt-5">
<div class="title">
<h1>Some other text that is long and takes two line to display</h1>
</div>
<div class="line">
</div>
<div class="price">
$99
</div>
</div>