您可以在http://jsfiddle.net/ryamx/2/找到示例代码
#c {
width:110px;
height:57px;
border:1px solid blue;
margin-top:250px;
clear:right;
}
我的目的是通过更改边距顶部的值来移动框 c。它具有明确的属性,然后它不起作用。为什么?
简单地说,如何“明确”影响元素行为
您可以在http://jsfiddle.net/ryamx/2/找到示例代码
#c {
width:110px;
height:57px;
border:1px solid blue;
margin-top:250px;
clear:right;
}
我的目的是通过更改边距顶部的值来移动框 c。它具有明确的属性,然后它不起作用。为什么?
简单地说,如何“明确”影响元素行为
尝试clear:both;
<div id="b"> b</div>
<div style="width:100%;clear:both;"></div>
<div id="c">c </div>
Actually its margin-collapsing basically see the attached image
so we can remove that margin-collapsing
through float
Give the float:left;
to your id #C
CSS
#c {
width:110px;
height:57px;
border:1px solid blue;
margin-top:250px;
clear:both;
float:left;
}
Now see the updated image its taking margin
after #b