当前位置:编程学习 > html/css >>

css实现圆形中居中显示文字核心点 line-height

css画一个实心圆,并在圆中居中显示一行标题

画圆:这里需要注意 border-radius:50%

居中显示文字:此处需要令 line-height 值等于 height ,并设置 text-align:center


  <view class="circle">
    <view class='circle-text'>
    {{yizuotu}}
    </view>
  </view>

.circle{
  width: 360rpx;
  height: 360rpx;
  margin-top: 180rpx;
  border-radius: 50%;
  background-color: #1E90FF;
}

.circle-text{
  width: 360rpx;
  height: 360rpx;
  line-height: 360rpx;
  text-align: center;
  font-size: 56rpx;
  color: #ffffff;
}
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,