Hallo isabel
mal wieder streß mit CSS. Ich will geren das das blaue Div sich automatisch unterr das gelbe Div ,setzt und dachte, das das mit relativer Positioniereung geht??
So wie ich das mache aber nicht?
position:relative bedeutet nur, dass das Element relativ zu _seiner_ Ausgangsposition platziert wird.
.green{position:absolute; border:1px solid black; width:500px; height:500px; background-color:green;}
.top { position:absolute; top:100px; left:200px; width:200px; height:100px;background-color: yellow;}
.blue{ position:relative; height:100px; width:100px; border:1px solid black; background-color: blue;}
[...]
<div class="green">
<div class="top"></div>
<div class="blue"></div>
</div>
Da du ja das gelbe DIV-Element absolut positionierst und auch seine Höhe auch festgelegt ist, kannst du doch auch das blaue DIV-Element absolut positionieren:
position:absolute; top:200px; left:200px;
Einfach nur den Abstand zum oberen Rand und die höhe des gelben DIVs addieren.
Schöne Grüße
Johannes
ss:| zu:) ls:[ fo:) de:] va:) ch:? sh:( n4:& rl:( br:< js:| ie:{ fl:( mo:}