【发布时间】:2011-08-19 23:00:44
【问题描述】:
我有一个 position:relative 的 div。 在该 div 中,我已经放置了带有 position:absolute 的图像,因为我将有一个带有淡入和淡出的幻灯片,并且图像必须绝对定位。
我想对齐居中的绝对定位图像 他们的父 div。这个可以吗?? 因为在 css 部分我已经定义了所有的图像是
left:0px;
我的编码如下:
<html>
<head>
<style type="text/css">
div img{
border:1px solid blue;
position:absolute;
left:0px;
top:0px;
}
</style>
</head>
<body>
<div style="border:2px solid red;position:relative;width:500px;height:300px;">
<img src="01.JPG" width="403" height="300"/>
<img src="02.JPG" width="403" height="300"/>
<img src="03.jpg" width="170" height="290"/> <!-- this is a portrait,BIG problem here!!! --> <!-- The image is positioned left -->
</div>
</body>
</html>
谢谢,提前!
【问题讨论】:
标签: html css css-position