扩展前一篇“上中下三栏布局”,中间栏划分成两列,一列宽度固定,一列宽度随浏览器窗口宽度的变化而变化。固定宽度列定义为#side,可分为左侧布局和右侧布局,分别实现如下:

1-2-1左侧固定宽度布局

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>1-2-1左侧固定宽度布局</title>
<style type="text/css">
html, body, .container {margin:0;padding:0;height: 100%;text-align:center;}
body > .container {height: auto; min-height: 100%;}
#main {height: 100%;padding-bottom: 35px;} /* 必须使用和footer相同的高度 */
.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;font-size: 0;}
.clearfix{display:inline-block}
/* Hides from IE-mac \*/
* html .clearfix { height: 1%;}
.clearfix {display: block;}
#contentWrap {float: left;width: 100%;height:100%;}
#content {margin-left: 300px;}
#side{float:left;margin-left:-100%;height:100%;position:relative;width: 300px;}
#footer{height: 35px;line-height: 35px;text-align: center;position:relative; margin-top: -35px;clear:both;}
#header{height:90px;background-color:#666666;}
#content{background-color:#888888;}
#side{background-color:#777777;}
#footer{background-color:#999999;}
</style>
</head>
<body>
<div class="container">
<!-- 头部 -->
<div id="header">header</div>
<div id="main" class="clearfix">
<div id="contentWrap">
<div id="content">content</div>
</div>
<div id="side">side</div>
</div>
</div>
<!-- 底部 -->
<div id="footer">footer</div>
</body>
</html>

  

1-2-1右侧固定宽度布局

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>1-2-1右侧固定宽度布局</title>
<style type="text/css">
html, body, .container {margin:0;padding:0;height: 100%;text-align:center;}
body > .container {height: auto; min-height: 100%;}
#main {height: 100%;padding-bottom: 35px;} /* 必须使用和footer相同的高度 */
.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;font-size: 0;}
.clearfix{display:inline-block}
/* Hides from IE-mac \*/
* html .clearfix { height: 1%;}
.clearfix {display: block;}
#contentWrap {margin-left: -300px;float: left;width: 100%;}
#content {margin-left: 300px;}
#side {float: right;width: 300px;}
#footer{height: 35px;line-height: 35px;text-align: center;position:relative; margin-top: -35px;clear:both;}
#header{height:90px;background-color:#666666;}
#content{background-color:#888888;}
#side{background-color:#777777;}
#footer{background-color:#999999;}
</style>
</head>
<body>
<div class="container">
<!-- 头部 -->
<div id="header">header</div>
<div id="main" class="clearfix">
<div id="contentWrap">
<div id="content">content</div>
</div>
<div id="side">side</div>
</div>
</div>
<!-- 底部 -->
<div id="footer">footer</div>
</body>
</html>

常见UI布局之1-2-1单列变宽布局的更多相关文章

  1. CSS 布局总结——变宽度布局

    变宽度布局 1-2-1 等比例变宽 总宽度设置 width: 85%; min-width: 650px; (关于IE6的min-width支持,可用) content 设置 width: 66%;  ...

  2. css 两列布局中单列定宽单列自适应布局的6种思路

    前面的话 说起自适应布局方式,单列定宽单列自适应布局是最基本的布局形式.本文将从float.inline-block.table.absolute.flex和grid这六种思路来详细说明如何巧妙地实现 ...

  3. 【Android UI】Android开发之View的几种布局方式及实践

    引言 通过前面两篇: Android 开发之旅:又见Hello World! Android 开发之旅:深入分析布局文件&又是“Hello World!” 我们对Android应用程序运行原理 ...

  4. CSS布局 两列布局之单列定宽,单列自适应布局思路

    前言 说起自适应布局方式,单列定宽单列自适应布局是最基本的布局形式.比如斗鱼的直播间,后台管理系统都是常用的 我们将从 float, inline-block, table, absolute, fl ...

  5. Android常见UI组件之ListView(二)——定制ListView

    Android常见UI组件之ListView(二)--定制ListView 这一篇接上篇.展示ListView中选择多个项及实现筛选功能~ 1.在位于res/values目录下的strings.xml ...

  6. Css学习总结(3)——CSS布局解决方案 - 水平、垂直居中、多列布局、全屏布局

    居中布局 水平居中 子元素于父元素水平居中且其(子元素与父元素)宽度均可变. inline-block + text-align <div class="parent"> ...

  7. PC响应式、固宽布局思想

    截止目前,国内绝大多数内容为主的网站(知乎,果壳,V2EX,网易新闻等)均使用内容区定宽布局,大多数电商网站(网易考拉,京东,聚美优品)也使用了内容区定宽的布局,也有些网站使用了自适应布局. 如果不明 ...

  8. Android 布局的一些控件的补充和布局的补充(今儿没课)

    前面写的博客可能会有点乱: 1,是不太会排版. 2,就是我一边看书,一边听学长讲课,所以有的知识就融入进去了,我写的都是自己的意见和理解,大家取我精华,弃我糟粕哈. 今天是书上的内容,主要讲布局的,一 ...

  9. CSS 实现:两栏布局(等宽布局)

    ☊[实现要求]:两栏等宽布局 <div class="demo3"> <div class="col-1"></div> & ...

随机推荐

  1. Get请求中文乱码的几种解决方式

    1.将字符串转码:new String("xxxxx".getBytes("iso-8859-1"),"utf-8")         这种 ...

  2. Apache Spark技术实战之9 -- 日志级别修改

    摘要 在学习使用Spark的过程中,总是想对内部运行过程作深入的了解,其中DEBUG和TRACE级别的日志可以为我们提供详细和有用的信息,那么如何进行合理设置呢,不复杂但也绝不是将一个INFO换为TR ...

  3. 记录一写Android常用API

    Location.getLatitude() 纬度 Location.getLongitude() 经度 获取 运行 应用包名 顶层交互 TOP包名 主Activity //获取当前系统中 正在运行的 ...

  4. ajax的使用:(ajaxReturn[ajax的返回方法]),(eval返回字符串);分页;第三方类(page.class.php)如何载入;自动加载函数库(functions);session如何防止跳过登录访问(构造函数说明)

    一.ajax例子:ajaxReturn("ok","eval")->thinkphp中ajax的返回值的方法,返回参数为ok,返回类型为eval(字符串) ...

  5. CG_INLINE,inline 内联函数

    内联函数,即在编译的时候将函数体替换函数调用,从而不需要将parameter,return address进行push/pop stack的操作,从而加速app的运行,然而,会增加二进制文件的大小. ...

  6. JQuery中的选择器的总结

    JQuery的选择器十分的强大,但是我平常经常用到的却十分的有限,趁现在有时间我感觉有必要总结一下. 基本选择器 $("#ID") 选择ID所对应的标签元素 返回一个标签元素$(& ...

  7. scala中的集合框架

  8. idea使用心得(2)-安装设置与创建web项目

    idea 是与eclipse齐名的IDE(集成开发工具),以智能闻名,不过对于熟悉eclipse的的用户来说,初次接触idea有些让人搞不清方向,下面介绍一下简单的使用 方式. 1.安装 官网下载ul ...

  9. p6 备忘录

    1.报表执行过程:PROC_PM_RP_Implent,PROC_PM_RP_Implent 2.新增用户无法获取p6 计划,主要是因为没有项目信息.分类码授权(计划分类).

  10. C++学习笔记 四种新式类型转换

    static_cast ,dynamic_cast,const_cast,reinterpret_cast static_cast 定义:通俗的说就是静态显式转换,用于基本的数据类型转换,及指针之间的 ...