如何通过转移到另一个div内容上制作一个浮动div

时间:2015-04-21 17:17:10

标签: html css

我必须在另一个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>

感谢。

1 个答案:

答案 0 :(得分:0)

这是你需要的吗? 检查片段,如果是,你只需要将内部div放入float:left;

&#13;
&#13;
.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;
&#13;
&#13;