CSS:防止一个div包裹在另一个div下面

时间:2013-02-25 07:03:04

标签: html css

如何防止一个div包裹在另一个div下?具体来说,我希望第二个div始终位于第一个div的右侧,即使调整浏览器宽度以使第二个div的内容必须换行。

我总是希望divs并排: I want this the divs to always be side by side

并且永远不会这样,即使调整浏览器窗口大小以使第二个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>

1 个答案:

答案 0 :(得分: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/