css中怎么实现图片后面的文字居中

2025-03-05 12:27:06
推荐回答(2个)
回答1:

这种情况推荐, 大概就是这样的
.divImg {
position: relative;
width: 200px;
height: 200px;
}

.divText {
position: absolute;
top: 50%;
margin-top: -10px; /* height的一半*/
width: 100px;
height: 20px;
}

回答2:

什麽东东 ?你想表达的是撒子哟。