CSS
.div1 { overflow: hidden; width: 500px; } /* this will clear your float. width given for example purposes */
.div2 { float: right; width: 200px; }
Run Code Online (Sandbox Code Playgroud)
HTML
<div class="div1">
<div class="div2">
<p>div 2 contents</p>
</div>
<p>div 1 contents</p>
</div>
Run Code Online (Sandbox Code Playgroud)
如果你想让它保留块显示和静态位置:
.inner { width: ##px, margin-left: auto; margin-right: 0 }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6791 次 |
| 最近记录: |