It appears that certain letters like g
, y
, q
, etc. which have a downward sloping tail, are causing issues with vertical centering. Here is an image illustrating the problem https://i.sstatic.net/Pcnl8.png.
The characters inside the green box are perfectly aligned, as they lack a downward tail. The ones in the red box highlight the issue.
I am seeking to achieve perfect vertical centering for all characters. In the provided image, characters with a downward tail are not vertically centered. Is there a way to solve this?
Here is the fiddle showcasing the complete problem.
.avatar {
border-radius: 50%;
display: inline-block;
text-align: center;
width: 125px;
height: 125px;
font-size: 60px;
background-color: rgb(81, 75, 93);
font-family: "Segoe UI";
margin-bottom: 10px;
}
.character {
position: relative;
top: 50%;
transform: translateY(-50%);
line-height: 100%;
color: #fff;
}
<div class="avatar">
<div class="character">W</div>
</div>
<div class="avatar">
<div class="character">y</div>
</div>