css - 在 div 周围环绕文本

标签 css html css-float

我有这样的布局:

Header div
divLeft divRight
Footer div

divLeft 是一堆文本,divRight 是一个包含一些东西的 div。 divLeft 更长,我希望文本在 divright 下换行。现在它只是制作两列并且在 divRight 下有很多空白区域。帮助?谢谢!

最佳答案

divRight 放入 divLeft 并 float 它。

试试这个:

CSS

<style type="text/css">
#primary, #header, #footer {
    float: left;
    width: 100%;
}

#secondary {
   float: right;
      width: 200px; /* or whatever width you want */
}
</style>

HTML

<div id="header">
</div>
<div id="primary">
   <div id="secondary">
      <p>Put your content here that goes on the right</p>
   </div>
   <p>Put your content here<br /> 
      that goes on the left<br /> 
      and should wrap under the right-hand column</p>
</div>
<div id="footer">
</div>

关于css - 在 div 周围环绕文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1504587/

相关文章:

css - 让浏览器记住一个 :visited link until browser is closed

jquery - 如何应用CSS动画而不刷新

html - 主体不会扩展以包含相对定位的元素

html - 如何制作一个使用整个左侧(1/4)的div元素?

html - CSS 非环绕 float div

javascript - 使用子数组 Angular 自动完成选择

javascript - 需要在右下角的 css div 中定位 html5 Canvas

html - float 元素出现在下方一行

html - 防止侧边栏下推内容,在小屏幕上放在中间

javascript - 为什么双引号 PHP echo 字符串中的双斜杠注释会产生 JS 错误?