css-flex:在不確定div高的情況下讓圖片文字上下左右居中

lulu發表於2019-01-09

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;}

相關文章