求教样式大佬,被难住了
发布于 6 年前 作者 zouyan 10143 次浏览 来自 问答

.icon3{

display: flex;

align-items: center;

justify-content: center;  

width: 100px;

height: 100px;

/* margin-left: -8%; */

margin-top: 150rpx;

border-radius: 500px;

float: left;

}

.shuxian{

width: 8px;

height: 200px;

float: left;

margin-left: 40rpx;

margin-top: 40rpx;

}

.ziti1{

color: black;

font-size: large;

margin-left: 30rpx;

margin-top: 20rpx;

float: left;

}

<view>

<image class=‘shuxian’ src=’…/images/shuxian.png’></image>

<text class=‘ziti1’>上班时间 8:30</text>

<button type=‘primary’ class=‘icon3’>上班打卡8:30</button>

</view>

这是代码,想实现“上班打卡”这个按钮水平居中,但是一直没有效果

3 回复

按钮外面套一个view,

width:750rpx,

position:relative,

display:flex,

justify-content: center,

.icon3{

position: absolute;

top: 150rpx;

left: 0;

right: 0;

bottom: 0;

width: 100px;

height: 100px;

border-radius: 50%;

}这样可好?

你试一下line-height呢,给100试试

回到顶部