為什么不需要設置position就可以實現左邊固定寬度右邊自適應?
編寫html代碼
<div class="top">top</div>
<div class="main">
? ? ? <div class="right">right</div>
? ?<div class="left">left</div>
</div>
<div class="foot">foot</div>
2. 編寫CSS部分
.top{height:100px; background:#ccc}
.left{ width:200px; height:500px; background:blue; } ?----要實現.left固定.right自適應為什么
.right{ margin-left:210px;height:500px; background:#9C9;}不用加absolute?
.foot{ height:50px; background:#F63 }
?
2016-03-09
你這個代碼實際上不是自適應,僅僅是通過設置margin-left實現寬度的默認設置,left和right兩個塊都不在一行
2016-03-05
因為左邊絕對固定了。右邊不設置寬度就會有自適應的效果