.top{height:100px;background:#ccc;margin:0 auto}.main{height:600px;background:red;position:relative}.left{ height: 600px; width:200px; background: blue;? ? positive:absolute;top:0;left:0}.right{ height: 600px; width:100%; background: green; position:absolute; margin-left:210px; }.foot{height:50px;background:#F63;}
2 回答
淵翼
TA貢獻2條經驗 獲得超0個贊
width: 100%也就是說寬度跟父元素一樣寬,然后又加了一個margin-left:210px,結果所以就超出父元素啦。
所以可以把.right的樣式修改一下,最終代碼如下:
.top{
??height:?100px;
??background:?#ccc;
}
.main{
??height:?600px;
??background:?red;
??position:?relative
}
.left,?.right?{
??position:?absolute;
??top:?0;
??height:?100%;
}
.left{
??width:?200px;
??background-color:?blue;
??left:?0
}
.right{
??background-color:?green;
??left:?210px;
??right:?0;
}
.foot{
??height:?50px;
??background:?#F63;
}- 2 回答
- 0 關注
- 1132 瀏覽
相關問題推薦
添加回答
舉報
0/150
提交
取消
