1、 <style type="text/css">
.a{
height:100px;
width:100px;
border:20px solid red;
position:relative;
}
.s{
position:absolute;
height:20px;
width:20px;
background-color:blue;
}
</style>
</head>
<body>
<div class="a">
<div class="s"></div>
</div>
2、
<style type="text/css">
.a{
height:100px;
width:100px;
border:20px solid red;
}
.s{
float: left;
height:20px;
width:20px;
background-color:blue;
}
</style>
</head>
<body>
<div class="a">
<div class="s">
</div>
</div>
</body>
总结:float与绝对定位的参考点不包括padding!