html:
<div class="img"><img src=''/></div>
<div class="text"><text>ddddd</text></div>
css:
.img{width:100%;height:100%;display:flex;align-items: center;justify-content: center;}
.text{width:100%;height:100%;display:flex;align-items: center;justify-content: center;}
css-flex:在不确定div高的情况下让图片文字上下左右居中
最新推荐文章于 2024-08-16 15:59:23 发布