<div>里包含<p>标签疑问
来源:广州中睿信息技术有限公司官网
发布时间:2012/10/21 23:25:16 编辑:admin 阅读 306
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-t
<!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>
    
<title>左中右版式</title>
    
<style type="text/css">
        body
        
{
            margin
: 0px;
            padding
: 0px;
            font-family
: Arial;
            color
: #060;
            background-color
: #dddddd;
        
}
        #banner
        
{
            margin
:0px;
        
}
        #mainBox
        
{
            margin
:0px;
        
}
        #left
        
{
            position
: relative;
            top
: 0px;
            left
: 0px;
            margin
: 0px;
            background
: #cce9ff;
            width
: 190px; /* 固定宽度 */
        
}
        #middle
        
{
            padding
: 10px;
            background
: #ffffff;
            margin
: 0px 190px 0px 190px; /* 左右空190px */
            margin-top
: 0px;
        
}
        #right
        
{
            position
: relative;
            top
: 0px;
            right
: 0px;
            margin
: 0px;
            background
: #cce9ff;
            width
: 190px;
        
}
        p
        
{
            font-size
: 12px;
            
            margin
: 20px 0px 0px 20px;
            padding
: 10px;
        
}
        pre
        
{
            font-size
: 12px;
            line-height
: 20px;
            margin
: 20px 0px 10px 0px;
            font-family
: arial;
        
}
    
</style>
</head>
<body>
    
<div id="banner"><img src="banner1.jpg" alt="" />
    
</div>
    
<div id="mainBox">
        
<div id="left">
            
<p>
                left
</p>
        
</div>
        
<div id="middle">
            
<pre>
body{
    margin:0px; padding:0px;
    font-family:arial;
    color:#060;
    background-color:#CCC;
}
#left{
    position:absolute;
    top:0px;
    left:0px;
    margin:0px;
    background:#FFF;
    width:190px;/* 固定宽度 */
}
#middle{
    padding:10px;
    background:#FFF;
    margin:0px 190px 0px 190px;/* 左右空190px */
    margin-top:0px;
}
#right{
    position:absolute;
    top:0px;
    right:0px;
    margin:0px;
    background:#FFF;
    width:190px;/* 固定宽度 */
}
p{
    font-size:12px;
    line-height:22px;
    margin:20px 0px 10px 0px; 
    padding:10px;
}
pre{
    font-size:12px;
    line-height:20px;
    margin:20px 0px 10px 0px;
    font-family:arial;
}
</pre>
        
</div>
        
<div id="right">
            
<p>
                right
</p>
        
</div>
    
</div>
    
<div id="footer">aappooiiuuyy</div>
</body>
</html>

p标签包含的范围

 

p标签的父标签<div id="left">包含的范围

 

为什么出现如上结果呢?

因为父标签没设置padding属性的原因。

而此问题在ie6不存在。



合乎自然而生生不息。。。
联系我们CONTACT 扫一扫
愿景:成为最专业的软件研发服务领航者
中睿信息技术有限公司 广州•深圳 Tel:020-38931912 务实 Pragmatic
广州:广州市天河区翰景路1号金星大厦18层中睿信息 Fax:020-38931912 专业 Professional
深圳:深圳市福田区车公庙有色金属大厦509~510 Tel:0755-25855012 诚信 Integrity
所有权声明:PMI, PMP, Project Management Professional, PMI-ACP, PMI-PBA和PMBOK是项目管理协会(Project Management Institute, Inc.)的注册标志。
版权所有:广州中睿信息技术有限公司 粤ICP备13082838号-2