Web设计之网页布局CSS技巧
1、两列布局
1.1、左列固定,右列自适应
#left{ width:190px; float:left; }
#right{ margin-left:205px; }
1.2、右列固定,左列自适应
#left{ float:left; width:100%; }
#right{ float:left; margin-left:-100px; width:100px; }
2、三列布局
2.1、左右宽度固定,中间自适应
#left{ float:left; width:200px; }
#middle{ margin:0 210px; }
#right{ float:right; width:200px; }
2.2、中间宽度固定,左右自适应
这个有点复杂,有必要先贴html
<div class="wrap">
<div class="left">
<div class="leftWrap">left左列</div>
</div>
<div class="right">
<div class="rightWrap">right右列 http://www.cnblogs.com/sosoft/</div>
</div>
<div class="center">Center</div>
</div>
css样式:
.wrap{position:relative;overflow:hidden;width:100%}
.left{float:left;width:50%;margin-left:-400px;padding-left:200px; }
.leftWrap{margin-left:200px;background:#aaa;}
.right{float:right;width:50%;margin-right:-400px;padding-right:200px;}
.rightWrap{margin-right:200px;background:#aaa;}
.center{position:absolute;left:50%;margin-left:-200px;width:400px;background:#eee;}
3、上中下三行布局
html { height:100%; }
body { height:100%; }
/*如需满屏,则对html和body都设置height:100%*/
#top { position:absolute; left:10px;top:0px;right:10px;height:50px;}
#main { position:absolute; left:10px;top:60px;bottom:60px;right:10px;overflow:auto;}
#bottom { position:absolute; left:10px; bottom:0px; right:10px; height:50px;}xi
/*IE6下*/
#top { *height:50px; *margin-top:-60px; *margin-bottom:10px; *position:relative; *top:0; *right:0; *bottom:0; *left:0;}
#main { *height:100%; *margin-left:210px; _margin-left:207px; *position:relative; *top:0; *right:0; *bottom:0; *left:0;}
#bottom { *height:50px; *margin-top:10px; *position:relative; *top:0; *right:0; *bottom:0; *left:0;}
最新文章
- GDUFE-OJ 1203x的y次方的最后三位数 快速幂
- Load Audio or Vedio files
- c#winform如何通过控件名查找控件
- 从Lumia退役看为什么WP走向没落
- BZOJ2492 Revenge of Fibonacci
- NTP服务搭建
- HDU 3342 Legal or Not (图是否有环)
- jquery获取表格中特定列
- C语言中long类型,int类型
- python 正则表达式 学习笔记(不断补充ing)
- SDL2来源分析7:演出(SDL_RenderPresent())
- 10、 iOS 加载图片选择imageNamed 方法还是 imageWithContentsOfFile
- JAVAEE——spring02:使用注解配置spring、sts插件、junit整合测试和aop演示
- 为什么使用JDBC操作MySQL需要添加Class.forName(";com.mysql.jdbc.Driver";)
- web服务-1、http协议的三次握手四次挥手
- MyBatis 源码分析 - 内置数据源
- samtools
- FastReport二维码打印存在的问题
- Taro开发微信小程序
- Linux系统下wetty安装和使用说明
热门文章
- 【吐血分享】SQL Server With As 递归获取层级关系数据
- iOS——Core Animation 知识摘抄(二)
- iOS 和 Android 测试托管平台 FIR.im 的注册与常用功能
- Android 代码混淆之部分类不混淆的技巧
- eclipse提交项目到github
- VS2013模块对于SAFESEH映像是不安全的解决方法
- iOS开发中 workspace 与 static lib 工程的联合使用
- Entity Framework 程序设计入门二 对数据进行CRUD操作和查询
- 通过Class获取标签,兼容的几种思路
- Surface Normal Averaging