宜昌本地软件开发与弱电工程服务商
项目咨询 · 快速响应

CSS左边固定,右边自适应的布局

2016-10-13 00:16:48 点击量:100 标签: 收藏本文

一、左边固定,右边自适应的布局

1. 左边左浮动,右边加个overflow:hidden;
  #lt{ float: left;width:200px; background: #ff0;}
  #rt{ overflow: hidden; background: #f0f;}

2. 左边左浮动,右边加个margin-left;
  #lt{ float: left; width:200px; background: #ff0;}
  #rt{ margin-left: 200px; background: #f0f;}

3. 左边绝对定位,右边加个margin-left;
  #lt{ position: absolute; top:0; left:0; width:200px; background: #ff0;}
  #rt{ margin-left: 200px; background: #f0f;}

4. 左右两边绝对定位,右边加个width,top,left,right
  #lt{ position: absolute; top:0 ; left:0 ;width:200px; background: #ff0;}
  #rt{ position: absolute; top:0;left:200px;width:100%;rigth:0;background: #f0f;}
上一篇: 判断图片加载完成的三种方式
下一篇: