Is there any way to get the border height always the height of the visual text block (from cap height of the first line to descender of the last line) instead of the physical height of the parent element?
As you can see here, the left border line is always sticking out above the text and also below. So we need to crop that few excessive pixels of the border to match the text's visual block height. I tried below or should there be another way to do this. It should not be a fixed height due to text that displays wider and narrower on different screen sizes.
I tried to crop the border line with padding, margin, height at 95% but all don't work.
.line-left-blue {
border-left: 8px solid #007dc3;
padding-left: 14px;
}
h2 {
margin: 0px;
}
<div class="line-left-blue">
<h2>Maecenas nec odio et ante tincidunt tempus.</h2>
<div>Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.</div>
</div>
