如題,如果子元素的margin-top是百分比,是以父元素的寬度爲基準進行計算的,而不是高度哦。
<div style="width:1000px; height:100px; background-color: red;">
<table></table>
<div style="width:500px; height:500px; background-color: blue; margin-top:100px"></div>
</div>
可見,子元素的margin-top:10%剛好移動了父元素的寬度的百分之10,100px