2013-02-25 99 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