为什么不能以偏移父节点
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN " "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<meta name= "Author " content= "willko " />
<meta name= "Keywords " content= "留言板,guestbook,helloguestbook " />
<meta name= "Description " content= "过客留言 " />
<style type= "text/css ">
.msg {
border : 1px solid #99CCFF;
margin: 10px 0;
}
.info {
position: absolute;
left: 5px;
top: 20px;
border-right: 1px solid #ccc;
width: 150px;
height: 140px;
text-align: center;
}
</style>
<title> 留言板 - HelloGuestbook </title>
</head>
<body>
<p> asdf </p>
<div class= "msg ">
<div class= "info "> sd </div>
</div>
</div>
</body>
</html>
.info 是绝对定位,为什么不是以父节点.msg开始呢?
[解决办法]
.msg {
border : 1px solid #99CCFF;
margin: 10px 0;
position: relative;
}
不过position这东西,往往不是按想象中走的,不要期望太高