首页
微信
安卓
接口
移动
前端
专题
文档库
工具
网址
§
ITPOW
>>
文档
>>
CSS
CSS 实现一侧固定宽度,另一侧自动宽度
作者:vkvi 来源:ITPOW
(原创)
日期:2017-3-6
如下代码:一个是左侧固定宽度,右侧自动宽度;另一个是右侧固定宽度,左侧自动宽度。
<div style="width:500px; overflow:hidden; background:#999;"> <div style="float:left; width:100px; background:#f66;">left</div> <div style="margin-left:110px; background:#6f6;">right</div> </div> <div> </div> <div style="width:500px; overflow:hidden; background:#999;"> <div style="float:right; width:100px; background:#f66;">right</div> <div style="margin-right:110px; background:#6f6;">left</div> </div>
实现方法:一侧 float,另一侧不 float。
使用 float 的,固定宽度。
使用 float 的,写在前面,比如前面第二段代码。
没有使用 float 的,使用 margin。
相关文章
创建于2005年
渝ICP备05010272号-1
电邮:
cftea@126.com
即将跳转...