在div周围包装文本

5 html css css-float

我有这样的布局:

Header div
divLeft divRight
Footer div
Run Code Online (Sandbox Code Playgroud)

divLeft是一堆文本,divRight是一个带有一些东西的div.divLeft是一个更长的时间,我希望文本包装在divright之下.现在它只是制作两列,divRight下有很多空白区域.救命?谢谢!

Don*_*nut 9

放入divRight内部divLeft并漂浮它.

试试这个:

CSS

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

#secondary {
   float: right;
      width: 200px; /* or whatever width you want */
}
</style>
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)