[i=s] 本帖最后由 噢!麦嘎 于 2013-1-30 16:11 编辑 为什么 做一个 <div class="大IDV"> <div class=“小DIV”>在小的DIV里设置与上边距为20(margin-TOP:20px;),为什么整个大的DIV全都下沉,而不是只有这个下沉呢?</div> </div> 召唤高手。。@pocketj @銀琉迦 @百里叮 问题已解决:外边距合并问题,只有普通文档流中块框的垂直外边距才会发生外边距合并。行内框、浮动框或绝对定位之间的外边距不会合并。!108! 刚刚看教程看到了。。哭~
pockry 发表于 2013-1-22 14:09 你说的难道是这个? margin:0 auto; margin-top:20px;你帮我看下效果出来的样子。。。。。 就是 导航以下的整体DIV,本来是好好的 下面 紧贴着导航 但是我做了那个宽980高100的块 然后在里面填充了一张小图片 想要让小图片与上边距有20的空白 结果加了之后 整个导航以下的内容全都下沉了。。。 !1!
[i=s] 本帖最后由 风音洛洛 于 2013-1-22 16:00 编辑pockry 发表于 2013-1-22 14:09 你说的难道是这个? margin:0 auto; margin-top:20px;[mw_shl_code=css,true]body { margin:0 auto; padding:0px; font-size:12px; border:0px; } .top a { text-decoration:none; color:#c8e1ff; } .top a:hover { text-decoration:underline; } .top { height:45px; background:#426ca9; } .top_nr { width:1000px; height:45px; margin:0 auto; color:#c8e1ff; line-height:45px; } .top span { float:left; } .top ul { width:200px; height:45px; margin:auto; margin-left:330px; float:left; } .top ul li { height:45px; list-style-type:none; float:left; padding-left:3px; padding-right:3px; } .qq { width:107px; height:26px; float:left; margin-top:10px; } .head { height:367px; background:url(images/banner_jb.gif); } .banner { height:367px; background:url(images/banner.png) no-repeat; background-position:center; } .banner a { width:151px; height:44px; margin-left:1070px; margin-top:300px; float:left; } .nav a{ color:#FFFFFF; text-decoration:none; } .nav a:hover { text-decoration:underline; } .nav { height:51px; background:url(images/nav_jb.gif); } .nav_z { width:1002px; height:51px; background:url(images/nav.png) no-repeat; margin:0 auto; line-height:51px; } .nav ul { float:left; margin:0 auto; padding:0px; padding-left:50px; } .nav ul li { font-size:14px; color:#FFFFFF; font-weight:bold; float:left; padding-left:4px; padding-right:4px; list-style-type:none; } .con { height:3000px; background:url(images/bg.gif); background-position:center; margin:0 auto; } .con_dy { width:980px; height:100px; margin-top:20px; background:url(images/dy_zuo.gif) no-repeat; } [/mw_shl_code]