When styling customer initials within a circle, I sometimes encounter issues with font alignment, as seen in the image below where EW
is not centered properly.
In this code snippet, I am using border-radius
to create circular shapes for displaying customer initials. If a photo is available, it is overlaid on top as a temporary fix.
The challenge arises when trying to center the initials perfectly within the circle due to font restrictions.
<i [ngStyle]="{'background-color': dataItem.backgroundColor}"
style= "display: inline-flex;
align-items: center;
height: 25px;
width: 25px;
border-radius: 50%;
border: white;
border-style: solid;
border-width: 1px;" >
<span style="margin: 5px 0 0 4px; color: #000;font: 12px Arial;">
{{ dataItem.custInitials }}
</span>
<img src="{{ './assets/profiles/customers/' + dataItem.UID + '.jpg' }}"
onerror="this.style.display='none'; this.className='' "
(error)="noImage=true"
height="25" width="25" style="border-radius:30px; margin: -1px 0 0 -23px;" />
</i>