用css和html實現復雜結構的網頁布局
.left{ width:200px;height:500px;position:absolute;left:0;top:100px;background:blue;}
.right{background:#9C9;height:500px;margin-left:210px;}
請問left 中的絕對定位里的left:0,怎么解釋
.left{ width:200px;height:500px;position:absolute;left:0;top:100px;background:blue;}
.right{background:#9C9;height:500px;margin-left:210px;}
請問left 中的絕對定位里的left:0,怎么解釋
2016-11-24
舉報
2016-11-28
絕對定位的元素沒有已經定位的父輩元素的話,默認是相對于body的 ?你代碼里?position:absolute; left:0; top:100px; 也就是說left相對于瀏覽器頁面定位在距離左邊0px,距離上邊100px的位置,你top的高度正好是100px吧,所以left就正好定位在了top下靠左邊的位置。。。
2016-11-24
絕對定位,就是距離左端0px