div里 子块设置position:relative; 设置出的位置 受不受父块padding的影响?先谢谢了
看书上说relative是相对父块边框,但我试了下怎么感觉是相对原来位置的呢具体代码:<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Tra...
看书上说relative是相对父块边框,但我试了下 怎么感觉是相对原来位置的呢
具体代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>position relative</title>
<style type="text/css">
<!--
#father{
background-color:#CCCCCC;
border:1px solid #000000;
padding:5px;
}
#son1{
background-color:#999999;
font-size:12px;
font-family:Arial, Helvetica, sans-serif;
border:1px dashed #000000;
position:relative;
left:10px;
top:10px;
}
-->
</style>
</head>
<body>
<div id="father">
<div id="son1">
son1
</div>
</div>
</body>
</html> 展开
具体代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>position relative</title>
<style type="text/css">
<!--
#father{
background-color:#CCCCCC;
border:1px solid #000000;
padding:5px;
}
#son1{
background-color:#999999;
font-size:12px;
font-family:Arial, Helvetica, sans-serif;
border:1px dashed #000000;
position:relative;
left:10px;
top:10px;
}
-->
</style>
</head>
<body>
<div id="father">
<div id="son1">
son1
</div>
</div>
</body>
</html> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询