我的问题是将div放在"动态图片"下,并在动态图片下方的div下面有动态内容:
jsfiddle css类准备填写:
HTML:
<div id="wallDetailContent">
<section id="wallDetailMessage" style="width 100%">
<img class="wallDetailPicture" src="http://web.scott.k12.va.us/martha2/dmbtest.gif">
<div style="max-width:70%;">blah gik sig en tur, og købte blah med hjem</div>
</section>
<section class="belowPicture">
<p class="wallByDate"> 20140126220550</p>
<p class="wallByBy"> af </p>
<p class="wallByName"> Anders </p>
</section>
<section class="belowBelowPicture">
content (should be dynamic, able to fill all the height it need downwards.)
</section>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.wallDetailPicture{
top: 5px;
right : 5px;
position: absolute;
display:box;
width:auto;
height:auto;
max-width:30%;
max-height: 200px;
}
.wallByName{
font-weight: bold !important;
color: blue;
display:inline-block !important;
}
.wallByDate{
font-weight: bold !important;
display:inline-block !important;
}
.wallByBy{
display:inline-block !important;
}
.belowPicture{
background:red;
}
.belowBelowPicture{
background:green;
}
Run Code Online (Sandbox Code Playgroud)
目标看:

您可以混合relative和absolute定位尽可能多地使用相对位置元素绝对定位元素,但是您不能用absolute定位来做您要求的事情,因为一旦元素的位置受到另一个元素的位置的影响,这就是relative定位。
编辑:你可以实现你的使用后在做什么float和clear:http://jsfiddle.net/nDvYv/1/