<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<style>
body
{margin: 30px; font-size:9pt;}
.a, .b, .c, .d, .e
{
width: 100px;
height: 100px;
margin: 5 auto;
color: #fff;
background: #000;
}
.aa, .bb, .cc, .dd, .ee
{
top: 10px;
left: 10px;
width: 10px;
height: 10px;
overflow: hidden;
background: #F90;
}
.b, .d, .e
{position: relative;}
.cc, .dd, .ee
{position: absolute;}
</style>
</head>
<body>
<div class="a">
<div class="aa">
</div>
</div>
<%--A:均不设置postion,一般嵌套关系--%>
<div class="b">
<div class="bb">
</div>
</div>
<%--B:仅外div设置relative,一般嵌套关系--%>
<div class="c">
<div class="cc">
</div>
</div>
<%--C:仅内div设置absolute,文档中为嵌套关系,页面中内div浮起[非float],相对于页面定位,与外div无关。--%>
<div class="d" style="background: #ff0000">
<div class="dd">
</div>
</div>
<%--D:外div设置relative,内div设置relative,内div浮起来并相对于外div定位--%>
<div class="d" style="background: #ff0000">
<div class="dd" style="position: relative">
</div>
</div>
<%--D:外div设置relative,内div设置absolute,内div浮起来并相对于外div定位--%>
<div class="e">
<div class="ee" style="left: -10px;">
</div>
</div>
<%--E:这个是说明边界问题。-10 != 反向10px间距--%>
<%--注意两个红色的地方文字,其中,绝对定位在嵌套中,好象要站居一定位置,而相对定位则没有--%>
</body>
</html>