DIV+CSS框架

| |
[不指定 2008/12/26 09:51 | by 李茵 ]

单行一列

body { margin: 0px; padding: 0px; text-align: center; }
#content { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }  

两行一列

body { margin: 0px; padding: 0px; text-align: center;}
#content-top { margin-left:auto; margin-right:auto; width: 400px; width: 370px;}
#content-end {margin-left:auto; margin-right:auto; width: 400px; width: 370px;}

三行一列

body { margin: 0px; padding: 0px; text-align: center; }
#content-top { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }
#content-mid { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }
#content-end { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }  

单行两列

#bodycenter { width: 700px;margin-right: auto; margin-left: auto;overflow: auto; }
#bodycenter #dv1 {float: left;width: 280px;}
#bodycenter #dv2 {float: right;width: 410px;}  

两行两列

#header{ width: 700px; margin-right: auto;margin-left: auto; overflow: auto;}
#bodycenter { width: 700px; margin-right: auto; margin-left: auto; overflow: auto; }
#bodycenter #dv1 { float: left; width: 280px;}
#bodycenter #dv2 { float: right;width: 410px;}

三行两列

#header{ width: 700px;margin-right: auto; margin-left: auto; }
#bodycenter {width: 700px; margin-right: auto; margin-left: auto; }
#bodycenter #dv1 { float: left;width: 280px;}
#bodycenter #dv2 { float: right; width: 410px;}
#footer{ width: 700px; margin-right: auto; margin-left: auto; overflow: auto; }  

单行三列
绝对定位

#left { position: absolute; top: 0px; left: 0px; width: 120px; }
#middle {margin: 20px 190px 20px 190px; }
#right {position: absolute;top: 0px; right: 0px; width: 120px;}  

float定位一
xhtml:

<div id="warp">
<div id="column">
<div id="column1">这里是第一列</div>
<div id="column2">这里是第二列</div>
<div class="clear"></div>
</div>
<div id="column3">这里是第三列</div>
<div class="clear"></div>
</div>

CSS:

#wrap{ width:100%; height:auto;}
#column{ float:left; width:60%;}
#column1{ float:left; width:30%;}
#column2{ float:right; width:30%;}
#column3{ float:right; width:40%;}
.clear{ clear:both;}

float定位二
xhtml:

<div id="center" class="column">
<h1>This is the main content.</h1>
</div>
<div id="left" class="column">
<h2>This is the left sidebar.</h2>
</div>
<div id="right" class="column">
<h2>This is the right sidebar.</h2>
</div>


CSS:

body {margin: 0;padding-left: 200px;padding-right: 190px;min-width: 240px;}
.column {position: relative;float: left;}
#center {width: 100%;}
#left {width: 180px; right: 240px;margin-left: -100%;}
#right {width: 130px;margin-right: -100%;}

两行三列
xhtml:

<div id="header">这里是顶行</div>
<div id="warp">
<div id="column">
<div id="column1">这里是第一列</div>
<div id="column2">这里是第二列</div>
<div class="clear"></div>
</div>
<div id="column3">这里是第三列</div>
<div class="clear"></div>
</div>

CSS:

#header{width:100%; height:auto;}
#wrap{ width:100%; height:auto;}
#column{ float:left; width:60%;}
#column1{ float:left; width:30%;}
#column2{ float:right; width:30%;}
#column3{ float:right; width:40%;}
.clear{ clear:both;}

三行三列
xhtml:

<div id="header">这里是顶行</div>
<div id="warp">
<div id="column">
<div id="column1">这里是第一列</div>
<div id="column2">这里是第二列</div>
<div class="clear"></div>
</div>
<div id="column3">这里是第三列</div>
<div class="clear"></div>
</div>
<div id="footer">这里是底部一行</div>

CSS:

#header{width:100%; height:auto;}
#wrap{ width:100%; height:auto;}
#column{ float:left; width:60%;}
#column1{ float:left; width:30%;}
#column2{ float:right; width:30%;}
#column3{ float:right; width:40%;}
.clear{ clear:both;}
#footer{width:100%; height:auto;}

PS:这里列出的是常用的例子,而非研究之用,对一每个盒子,都没有设置margin,padding,boeder等属


默认分类 | 评论(11) | 引用(0) | 阅读(1388)
suigui1053 Email
2010/09/05 19:37
说的很好哦,很高兴看到这个! 欢迎来逛逛我的博客
macdavid55 Email Homepage
2010/09/05 01:39
逐字逐句地看完这个帖子以后,我的心久久不能平静,淘宝网,震撼啊!为什么会有如此好的帖子!我纵横网络BBS多年,自以为再也不会有任何帖子能打动我,没想到今天看到了如此精妙绝伦的这样一篇帖子!
allenoh45 Email Homepage
2010/09/05 01:38
大师的话真如“大音希声扫阴翳”,犹如“拨开云雾见青天”,使我等网民看到了希望,龙富足浴盆,看到了未来!晴天霹雳、醍醐灌顶或许不足以形容大师文章的万一;巫山行云、长江流水更难以比拟大师的文才!黄钟大吕,振聋发聩!你烛照天下,明见万里;雨露苍生,泽被万方!透过你深邃的文字,我仿佛看到了你鹰视狼顾、龙行虎步的伟岸英姿;仿佛看到了你手执如椽大笔、写天下文章的智慧神态;仿佛看见了你按剑四顾、指点江山的英武气概!
phxnvanu29 Email Homepage
2010/09/04 22:30
楼主的帖子实在是写得太好了。文笔流畅,修辞得体,深得魏晋诸朝遗风,洗脚盆,更将唐风宋骨发扬得入木三分,能在有生之年看见楼主的这个帖子。实在是我三生之幸啊。看完楼主的这个帖子之后,我竟产生出一种无以名之的悲痛感——啊,这么好的帖子,如果将来我再也看不到了,那我该怎么办?那我该怎么办?直到我毫不犹豫地把楼主的这个帖子收藏了,我内心的那种激动才逐渐平静下来。可是我立刻想到,这么好的帖子,倘若别人看不到,那么不是浪费楼主的心血吗?经过痛苦的思想斗争,我终于下定决心,牺牲小我,奉献大我。我要拿出这帖子奉献给人赏阅,我要把这个帖子一直往上顶,往上顶!顶到所有人都看到为止!
X3 Homepage
2009/08/24 14:15
网站做的真好! 代孕网与贵站交换友情连接QQ:458649409
adsf Email Homepage
2009/08/20 13:23
When Jack bowedwow goldbe perfect.
wert Email Homepage
2009/08/19 14:06
Looking wow gold
as
2009/06/26 13:52
潇潇
2009/04/30 16:30
田林
2009/04/23 10:19
脱硫楼主耐心真好啊
分页: 1/2 第一页 [1] [2] 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 请输入左侧的字母,不区分大小写