即使调整浏览器大小,我也想在页面中垂直和水平居中图像。
目前,我使用这个 CSS:
.centeredImage {
position: fixed;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -150px;
}
这个HTML:
<img class="centeredImage" src="images/logo.png">
它以 FF 为中心,但不在 IE 中(图像中心位于左上角)。有任何想法吗?
-机器人