下载此文档

css常用布局多行多列.txt


文档分类:IT计算机 | 页数:约4页 举报非法文档有奖
1/4
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/4 下载此文档
文档列表 文档介绍
CSS布局常用的方法:float : none | left | right 取值: none : 默认值。对象不飘浮 left : 文本流向对象的右边 right : 文本流向对象的左边它是怎样工作的,看个一行两列的例子 xhtml:

这里是第一列

这里是第二列


CSS: #wrap{ width:100%; height:auto;} #column1{ float:left; width:40%;} #column2{ float:right; width:60%;} .clear{ clear:both;} position : static | absolute | fixed | relative 取值: static : 默认值。无特殊定位,对象遵循HTML定位规则 absolute : 将对象从文档流中拖出,使用 left , right , top , bottom 等属性相对于其最接近的一个最有定位设置的父对象进行绝对定位。如果不存在这样的父对象,则依据 body 对象。而其层叠通过 z-index 属性定义 fixed : 未支持。对象定位遵从绝对(absolute)方式。但是要遵守一些规范 relative : 对象不可层叠,但将依据 left , right , top , bottom 等属性在正常文档流中偏移位置它来实现一行两列的例子 xhtml:

这里是第一列

这里是第二列

CSS: #wrap{ position:relative;/*相对定位*/width:770px;} #column1{ position:absolute; top:0; left:0; width:300px;} #column2{position:absolute; top:0; right:0; width:470px;} 他们的区别在哪? 显然,float是相对定位的,会随着浏览器的大小和分辨率的变化而改变,而position就不行了,所以一般情况下还是float布局! CSS常用布局实例一列单行一列 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;

css常用布局多行多列 来自淘豆网m.daumloan.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数4
  • 收藏数0 收藏
  • 顶次数0
  • 上传人zbfc1172
  • 文件大小0 KB
  • 时间2013-01-09