Board logo

标题: 第二个DIV盒子的外边框失效的问题 [打印本页]

作者: lovecss.com    时间: 2011-10-8 17:19     标题: 第二个DIV盒子的外边框失效的问题

我设置了2个DIV盒子,可第二个盒子的外边框怎么没显示出来,是在IE6中查看的,代码如下:
<!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>无标题文档</title>
<style>
.one{ border:1px blue solid;margin:300px;}
.two{ border:1px red solid; margin:100px; height:150px;}
</style>
</head>

<body>
<div class="one">
<div class="two">看一下效果</div>
</div>
</body>
</html>
效果如图,第二个DIV盒子的外边框margin:100怎么没有显示呢?
作者: lovecss.com    时间: 2011-10-8 21:03

这里人这么少啊,没人知道吗?
作者: lqiu0108    时间: 2011-10-11 23:39

给one或者two固定宽高,例如
.one{ border:1px blue solid;margin:300px;width:500px; height:500px;}
.two{ border:1px red solid; margin:100px; height:150px;}
作者: lovecss.com    时间: 2011-10-12 18:54

谢谢3楼啦,不过在没设定宽度的时候,margin怎么没无效呢,这是一个CSS中的默认规则吗?
作者: amk800    时间: 2012-3-3 10:07

上下两个DIV的margin会叠加 取较大的那个
作者: pigjiahua    时间: 2012-3-6 12:06

这个在IE8和火狐都能正常显示,为什么IE6不行???




欢迎光临 CSS论坛 (http://www.divcss5.com/bbs/) Powered by Discuz! 6.1.0