即使浏览器调整大小,我也希望将图像垂直和水平放置在页面中央。需要通过CSS在网页中居中放置图像
目前,我用这个CSS:
.centeredImage {
position: fixed;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -150px;
}
而这个HTML:
<img class="centeredImage" src="images/logo.png">
它中心的FF但不是IE(图像中心被放置在左上角)。有任何想法吗?
-Robot
你 “知道” 的形象的高度? – Jage 2010-03-23 17:40:18
是的,虽然很显然额外的信用问题是如何对所有图像进行一般处理。 – Robot 2010-03-23 18:07:45