css两列布局,一列固定宽度,另一列自适应宽度
2016-05-02 15:48
573 查看
<!DOCTYPE html> <html> <head> <title>两列之一固定,另一列自适应</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>1-2-1单列变宽布局</title> <meta name="description" content=""> <meta name="keywords" content=""> <style type="text/css"> *{ margin: 0; padding: 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -o-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; } html { min-height: 100%; _height:100%; height:100%; } body { min-height: 100%; _height:100%; height:100%; } #all { background: #EEE; border-left: 1px solid #ff0000; border-right: 1px solid #ff0000; padding: 0 20px 0 20px; margin: auto; font: 1.5em arial, verdana, sans-serif; width: 85%; min-height: 100%; _height:100%; } #header,#pagefooter,#container { margin: 0 auto; width: 85%; border: 1px solid #000000; } #contentwrap { /*包裹左侧div的容器*/ margin-left: -260px; /*留出位置给右侧固定的div*/ float: left; width: 100%; /*占满父级的宽度*/ } #content { margin-left: 260px; /*显示在contentwrap的右侧*/ border: 1px solid red; } #side { float: right; width: 260px; border: 1px solid green; } .clearfix::before { content: ""; display: table; width: 0; height: 0; overflow: hidden; } .clearfix::after { content: ""; clear: both; display: table; width: 0; height: 0; overflow: hidden; } .clearfix { zoom: 1; } </style> </head> <body> <div id="all"> <div id="header"> 头部 </div> <div id="container" class="clearfix"> <div id="contentwrap"> <div id="content">中部内容随网页缩放</div> </div> <div id="side">中部侧边固定宽度</div> </div> <div id="pagefooter"> 我是底部 </div> </div> </body> </html>
相关文章推荐
- Android布局的小窍门?
- CSS3属性教程与案例分享
- CSS3属性教程与案例分享
- CSS3的calc()使用
- 使用CSS3的appearance属性改变元素的外观
- Web布局连载——两栏固定布局(五)
- CSS3美化图片
- CSS3质感分析——表面线性渐变
- 分析选项卡底部内凹圆角制作
- 细说百度图片栏目——图片展示效果
- 8个实用的响应式设计框架
- 20+ Animation Scripts, Libraries and Plugins
- 新时代编辑神器:Atom
- 如何使用CSS3画出一个叮当猫
- 基于Jquery和CSS3制作数字时钟附源码下载(CSS3篇)
- 样式表CSS布局经验
- 在winform下实现左右布局多窗口界面的方法之续篇
- css网页布局中注意的几个问题小结
- DL.DT.DD实现左右的布局简单例子第1/2页
- 使用CSS框架布局的缺点和优点小结