繁体   English   中英

第一个元素是保证金底部10px,第二个元素是保证金最高10px,这个保证金最高只有当我把价值大于保证金底部时才有效,为什么?

[英]First element with margin-bottom 10px and second element with margin-top 10px, this margin-top only work if i put value large than margin-bottom, why?

我不知道但是li元素margin-top只有在h2元素的margin-bottom大的情况下才能工作,我想知道为什么?

<h2 style="padding:0px; margin:0; height:30px; line-height:30px; background-color:#FF0000; font-size:18px; font-family:Arial; margin-bottom:10px;">Test1</h2>
<ul style="list-style:none; padding:0; margin:0;">
<li style="height:50px; line-height:50px; background-color:#00FF00; font-size:12px; font-family:Arial; margin-top:10px;">Test2</li>
</ul>

谢谢。

你所描述的听起来很像崩溃的边缘

我建议查看http://reference.sitepoint.com/css/collapsingmargins,因为问题已经详细介绍,并提供修复方法。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM