<div id="div1" style="width:100%">
   <div id="div2" style="width:100px;"></div>
   <div id="div3"></div>
</div>如何让div3的宽度刚好填满div1里剩下的部分,如果用auto的话在ie里可以,但在ff或谷歌里就不行了,只会根据内容宽度自动调整大小

解决方案 »

  1.   

    <div id="div1" style="width:100%; ">
       <div id="div2" style="width:100px; float:left;"></div>
       <div id="div3" style="margin-left:100px;"></div>
    </div>
      

  2.   

    <div id="div1" style="width:100%">
       <div id="div2" style="width:100px; float:left"></div>
       <div id="div3" style="float:right"></div>
    </div>应该兼容很多浏览器
      

  3.   

     <div id="div1" style="width:100%;background:red;height:50px;float:left">
       <div id="div2" style="width:10%;background:blue;height:50px;float:left"></div>
       <div id="div3" style="width:90%;background:green;height:50px;float:left"></div>
    </div>我建议楼主要么都用px为单位,要么都用%为单位,这样浏览器好识别;一会%一会px在不同的浏览器中展现,效果可能不一样。
      

  4.   

    试过了还是不行啊,主要是不管width设为auto还是不设,ff都不会像ie一样自动扩张剩下的宽度,而只会根据内容的宽度而自动适应内容
      

  5.   


    呵呵,试过了可以,只是我之前比你多写了个float:left,<div id="div3" style="margin-left:100px;float:left"></div>,为什么多了个float:left就不行了呢?楼下的请回答