2013-02-25 86 views
6

如何防止一個div纏繞在另一個下面?具體來說,即使瀏覽器寬度調整爲第二個div的內容必須換行,我也希望第二個div始終位於第一個div的右側。CSS:防止一個div纏繞在另一個下面

我總是想的div是並排: I want this the divs to always be side by side

,並從來沒有像這樣,即使調整瀏覽器窗口,使得第2 div的內容必須包裝:
And never have the 2nd div wrap beneath the first div

<!DOCTYPE html> 
<html lang="en"> 
    <body> 
    <div class="columns"> 
     <div style="background-color: #990000; width:70px; float: left"> 
     Pic 
     </div> 
     <div style="background-color: #00FF00; float: left; " > 
     body some interesting large amount of content. some interesting large amount of content. 
     </div>  
    </div> 
    </body> 
</html> 

回答

5
<div class="columns"> 
    <div style="background-color: #990000; width:70px; float: left"> 
     Pic 
    </div> 
    <div style="background-color: #00FF00; margin-left: 70px;" > 
     body some interesting large amount of content. some interesting large amount of content. 
    </div>  
</div> 

一個例子:http://jsfiddle.net/arPzt/

+0

完美。謝謝! – 2013-02-25 07:32:13