当前位置: 首页 > 图文教程 > 网页制作 > CSS样式表 > CSS布局实例代码:两列布局实例

CSS样式表
简单学习CSS网页布局(初学者)
8个简单实用的CSS秘诀
Webjx收集基于CSS JS设计50款优秀的导航菜单
css word-break word-wrap 前台显示自动换行
css 自动换行 强制换行属性 (firefox+ie)
css 教学实例 漂亮的搜索框
CSS 折叠的菜单实现代码
关于html元素的 width属性无效果的解决方法
css 相对定位 绝对定位 浮动 分析
css 滑动门技术的介绍及实例分享
负边距创建自适应宽度的流体布局的实现方法
有利于SEO的DIV+CSS的命名规则小结
css盒子模型 css margin 外边框合并
css 优先级关系
input 文本框 文字垂直居中对齐 ie firefox
css margin-left在IE6下的问题的解决方法
IE8样式不正确显示问题
div中子div在firefox ie 水平居中对齐
css 不兼容性问题小结
CSS 3D立方体制作

CSS样式表 中的 CSS布局实例代码:两列布局实例


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-03   浏览: 71 ::
收藏到网摘: n/a

CSS两列布局,右侧固定,左侧自适应宽度
<div style="width:90%; margin:0 auto;">
   <div style="width:200px; float:right;">这是右侧的内容</div>
   <div style=" margin-right:210px;">这是左侧的内容,自适应宽度</div>
</div>
CSS两列布局,左侧固定,右侧自适应宽度
<div style="width:90%; margin:0 auto;">
   <div style="width:150px; float:left;>这是左侧的内容 固定宽度</div>
   <div style=" margin-left:160px;>中间内容,自适应宽度</div>
</div>
CSS三列布局,左右宽度固定,中间自适应宽度
<div style="width:90%; margin:0 auto;">
   <div style="width:200px; float:right; >这是右侧的内容 固定宽度</div>
   <div style="width:150px; float:left; >这是左侧的内容 固定宽度</div>
   <div style=" margin-left:160px;margin-right:210px;>中间内容,自适应宽度</div>
</div>
 
三列等高布局
<style>
*{ margin:0; padding:0}
#content{overflow:hidden}
#content #left,#content #center,#content #right{margin-bottom:-10000px;padding-bottom:10000px;width:300px;float:left;}
#content #left{background:#f00;}
#content #center{background:#0ff}
#content #right{background:#f0f}
</style>
<div id="content">
 <p id="left">left<br />left<br />left<br />left<br />left<br />left</p>
 <p id="center">center</p>
 <p id="right">right</p>
</div>