子要素の位置は、これによって影響を受ける可能性があります。
親要素の位置を相対に設定した後、子要素の位置を絶対に設定しようとすると、ドキュメントではなく親に対してのみ絶対に配置されます。
最初の例
<style>
#container
{
background:red none repeat scroll 0 0;
display:block;
position:relative;
top: 100px;
left: 100px;
width:100%;
}
#child
{
position: absolute;
top: 0px;
left: 0px;
}
</style>
<div id="container">
<div id="child">
I am absolutely placed relative to the container and not to the document
</div>
</div>
2 番目の例
<style>
#container
{
background:red none repeat scroll 0 0;
display:block;
top: 100px;
left: 100px;
width:100%;
}
#child
{
position: absolute;
top: 0px;
left: 0px;
}
</style>
<div id="container">
<div id="child">
I am absolutely placed relative to the container and not to the document
</div>
</div>
上記の 2 つの例を確認してみてください。違いがわかります。