"a1"
"a1b"

 

 

 

 

 

 

Absolute Positionierung bei verschachtelten Elementen

#a1 {
position: absolute;
height: 200px;
width: 300px;
background-color: #999999;
left: 20px;
top: 20px;
}
#a1b {
position: absolute;
height: 50px;
width: 50px;
left: 10px;
top: 20px;
background-color: #CCCCCC;
}

Das Div a1b befindet sich innerhalb von a1, daher wird die absolute Postionierung nicht am Browserfenster ausgerichtet sondern am Elternelement a1. Das Element a1 darf nicht vom Typ static sein, um diesen Effekt zu erreichen.

<div id="a1">"a1"
<div id="a1b">"a1b"</div>
</div>