如果是我,首先,把所有的内联样式从那里拿出来,朋友…只是因为。
第二,在你的跨度上去掉你的利润,然后申请
justify-content
给你的父母(因为你已经在使用flex了)。
第三,明白吗
img
出于多种原因将其标记为元素,并将其合并到您的应用程序中
[ngStyle]
background-image
为了更干净的DOM和更好看的图标。。。
background-color
回来做;
[ngStyle]="{'background-color': dataItem.backgroundColor,
'background-image': 'url(./assets/profiles/customers/' + dataItem.UID + '.jpg)'}"
如果失败了,它只会显示
下面是概念证明,干杯;
.profile-dot {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: center;
height: 3rem;
width: 3rem;
background-color: lightgray;
border-radius: 50%;
border: gray 2px solid;
background-size: cover;
background-position: center;
background-repeat: none;
}
.profile-dot span {
font-weight: 700;
color: #fff;
font-style: normal;
font-size: 120%;
}
<i class="profile-dot" style="background-image: url(https://i.stack.imgur.com/BVW9D.jpg)">
<span>CW</span>
</i>