footer占用了main的位置,跑到了left和right的下面
<style type="text/css"> body{ margin:0; padding:0; font-size:30px; color:#fff} .top{width:100%;background:purple;} .main{width=100%;background:red;position:relative;} .left{width:200px;background:blue;position:absolute;left:0px;} .right{position:absolute;right:0px;margin-left:10px;background:green;} .foot{width:100%;background:orange;} </style> </head> <body> <div class="top">top</div> <div class="main"> <div class="right">right</div> <div class="left">left</div> </div> <div class="foot">foot</div> </body>
结果是这样子的