html - 左右浮动两个div : How can I keep them on the same level when a page resizes?

标签 html css word-wrap css-float

给定以下 HTML:

<!DOCTYPE html>
<html>
<body>
  <div id="container">
    <div id="left" style="float: left; background-color: #777; width: 500px;">
      Here is some content. Blah blah blah etc.
      <div style="height: 50px;">Some more content</div>
      And finally some more.
    </div>
    <div id="right" style="float: right; background-color: #aaa; width: 500px;">
      Here is some content. Blah blah blah etc.
      <div style="height: 50px;">Some more content</div>
      And finally some more.
    </div>
    <div style="float: clear;"></div>
  </div>
</body>
</html>

我可以对 div#container 或其他标签做些什么来防止 div#right 在调整大小时移动到 div#left 下使窗口宽度小于 1000px 的浏览器窗口?

最佳答案

为你的容器设置一个min-width:

#container {
  min-width: 1000px;
}

关于html - 左右浮动两个div : How can I keep them on the same level when a page resizes?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4082894/

相关文章:

html - 使文本在自动宽度 div 内换行

css - "word-break: break-all"和 CSS 中的 "word-wrap: break-word"有什么区别

html - 向上移动按钮而不影响表格中上述 tr 元素的 css

html - index.html 未按 IOS 应用程序开发中的要求运行

html - 如何删除网页上的空白区域?

javascript - 统计网站新访问者的最简单方法

html - 使用 css 的 z-index

css - 如何获得下拉菜单的正确宽度

java - Eclipse Java 中的自动换行?

php - InvalidArgumentException Synfomy2