I have a grid of numbers and the selected one must be shown with a background gradient. So I used the normal procedure with flex-box, as we can see in the code. But the number isn't in the exact center of the square as it's supposed it should be.
.cell {
/* Square definition */
width: 100px;
height: 100px;
border: 1px solid black;
font-size: 2rem;
/* Centering */
display: flex;
justify-content: center;
align-items: center;
/* Background at the center */
color: white;
background: radial-gradient(ellipse at center, red 0%,red 50%, transparent 55%);
}
<div class="cell">15</div>
Why does this happen? How can I make the number be exactly in the middle of the square without any extra markup?
EDIT: On the left it's how it looks now, on the right it's how I think it should look like. The browser is Chrome on Linux.
EDIT II: There must be an issue with how this markup is rendered on Linux. Here's how I see the codepen courtesy of G-Cyr provided in a comment:
I tried the same codepen on Windows and it shows the number perfectly centered.