我有这样的布局:

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>

10-07 16:36