噢!麦嘎
DIV+CSS里 为什么会出现这种情况。。求教

本帖最后由 噢!麦嘎 于 2013-1-30 16:11 编辑

为什么 做一个

<div class="大IDV">

<div class=“小DIV”>在小的DIV里设置与上边距为20(margin-TOP:20px;),为什么整个大的DIV全都下沉,而不是只有这个下沉呢?</div>

</div>

召唤高手。。@pocketj @銀琉迦 @百里叮

问题已解决:外边距合并问题,只有普通文档流中块框的垂直外边距才会发生外边距合并。行内框、浮动框或绝对定位之间的外边距不会合并。!108!

刚刚看教程看到了。。哭~

噢!麦嘎
本帖最后由
展开Biu

本帖最后由 噢!麦嘎 于 2013-1-22 15:43 编辑

pockry 发表于 2013-1-22 14:09

你说的难道是这个?

margin:0 auto;

margin-top:20px;

内容我删了 怕被管理员说广告。。。

[查看全文]
噢!麦嘎
你说的难道是这个
展开Biu

pockry 发表于 2013-1-22 14:09

你说的难道是这个?

margin:0 auto;

margin-top:20px;

。。。太复杂了 我用了 不行

想把整个贴出来 又怕说打广告。。。。。!1!!4!

[查看全文]
pockry
你说的难道是这个
展开Biu

你说的难道是这个?

margin:0 auto;

margin-top:20px;

单边定义会被整体定义覆盖。 你用margin:20px auto 0 auto;

[查看全文]
噢!麦嘎
本帖最后由
展开Biu

本帖最后由 噢!麦嘎 于 2013-1-22 14:04 编辑

[mw_shl_code=xhtml,true]

.con {

height:3000px;

background:url(images/bg.gif);

background-position:center;

margin:0 auto;

}

.con_dy {

width:980px;

height:100px;

margin:0 auto;

margin-top:20px;

background:url(images/dy_zuo.gif) no-repeat;

}

[/mw_shl_code]

CON是大的DIV,CON_DY它里面的一个小IDV

为什么在小的DIV里调协了margin-top:20px; 然后整个CON整体下沉了呢?

[查看全文]