我必须在另一个div上浮动一个div。
----------------------------------------------
| div | asdfsdfsafasdfsafsfsafasfsd |
| floating | asdfsdfsafasdfsafsfsafasfsd |
|___________| asdfsdfsafasdfsafsfsafasfsd |
| asdfsdfsafasdfsafsfsafasfsdfsafasfsd |
| asdfsdfsafasdfsafsfsafasfsdfsafasfsd |
| |
| |
| |
| |
-----------------------------------------------
浮动div使内容移动或包装其他内容。这也是响应式设计。
编码
<tr>
<td style="background: #AAAAAA" colspan="2">
<div style="float:left;display:block;clear:both;background:#fff;padding:5px">
<p>navigation</p>
<p>asdfsadf</p>
<p>asdfasfd</p>
</div>
<p> section1</p><p> section1</p><p> section1</p><p> section1</p><p> section1</p><p> section1</p><p> section1</p><p> section1</p><p> section1</p><p> section1</p>
</td>
</tr>
感谢。
答案 0 :(得分:0)
这是你需要的吗? 检查片段,如果是,你只需要将内部div放入float:left;
.big{
background-color:#eee;
width:100%;
}
.in{
background-color:#00FF00;
float:left;
padding:30px;
}
&#13;
<div class="big">
<div class="in">
div floating
</div>asdfsdfsafasdfsafsfsafasfsd
asdfsdfsafasdfsafsfsafasfsdfsafasfsd
asdfsdfsafasdfsafsfsafasfsdfsafasfsd asdfsdfsafasdfsafsfsafasfsd
asdfsdfsafasdfsafsfsafasfsdfsafasfsd asdfsdfsafasdfsafsfsafasfsd asdfsdfsafasdfsafsfsafasfsdfsafasfsd asdfsdfsafasdfsafsfsafasfsd
asdfsdfsafasdfsafsfsafasfsdfsafasfsd
asdfsdfsafasdfsafsfsafasfsdfsafasfsd asdfsdfsafasdfsafsfsafasfsd
asdfsdfsafasdfsafsfsafasfsdfsafasfsd asdfsdfsafasdfsafsfsafasfsdfsafasfsd
</div>
&#13;