我有以下 div
<div id="over" style="position:absolute; width:100%; height:100%>
<img src="img.png">
</div>
如何对齐图片,使其位于div的中间和中心?
最佳答案
body {
margin: 0;
}
#over img {
margin-left: auto;
margin-right: auto;
display: block;
}
<div id="over" style="position:absolute; width:100%; height:100%">
<img src="http://www.garcard.com/images/garcard_symbol.png">
</div>
关于html - 将图像在 div 中居中对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4888223/