我有这样的布局:
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/