uniapp 入门实战 10:利用 css 实现文字居中在圆中心
实现
scss
.circle {
background: gold;
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
scss
<div class="circle">text</div>
效果
总结:
- 需要固定宽高,否则会导致文字被压扁