在中心和中间对齐图像在div [英] Align image in center and middle within div
本文介绍了在中心和中间对齐图像在div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下div
<div id="over" style="position:absolute; width:100%; height:100%>
<img src="img.png">
</div>
如何对齐图像以便位于div的中间和中心?
How to align the image so as to be located in the middle and center of div ?
推荐答案
#over img {
display: block;
margin-left: auto;
margin-right: auto;
}
这篇关于在中心和中间对齐图像在div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文