EDIT: It appears this problem only occurs on Mac Firefox (I tested on version 107), and is likely a bug specific to that browser.
In the snippet below, I am using the display:flex; align-items: center
trick to center some large text vertically. However, there is extra space at the bottom:
There is no padding, and I can't figure out what is causing the lack of symmetry. I've also tried removing the <span>
, and adjusting line-height
, but neither of those worked either.
How can I make the text appear centered between the top and bottom border lines. Of course I can add padding-top
to compensate manually, but I'd like a solution that actually solves the problem and would scale with text size.
Here is a snippet demonstrating the problem:
div {
border: 1px solid black;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
font-size: 5rem;
}
<div>
<span>$0.00</span>
</div>