• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com专业计算机教程网站
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure
您的位置:首页 > 网页设计 >CSS > 一些常用的DIV+CSS的网页布局所用的代码段

一些常用的DIV+CSS的网页布局所用的代码段

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2017-08-06

本文主要包含DIV+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; }

#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> </P> <P></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;}

您可能想查找下面的文章:

  • 学习DIV+CSS网页布局之混合布局
  • 学习DIV+CSS网页布局之三列布局
  • 学习DIV+CSS网页布局之两列布局
  • 学习DIV+CSS网页布局之一列布局
  • 前端设计师需要了解的9个问题
  • DIV+CSS中让布局、背景图片、文字内容居中的方法
  • DIV+CSS垂直居中一个浮动元素
  • 使用div+css布局过程中在什么时候使用table呢
  • DIV+CSS通过border样式制作带箭头提示框效果
  • div+css纵向导航如何实现且为导航添加超链接

相关文章

  • 2017-08-06css弹出层覆盖底层具体实现
  • 2017-08-06纯CSS打造忙碌光标适用于忙碌等待的情况
  • 2017-08-06使用font-face改变字体即加载外部字体
  • 2017-08-06h2在div IE7中不垂直居中问题解决方法
  • 2017-08-06IE系列不支持CSS的圆角border-radius等属性的解决方案
  • 2017-08-06使用css3和jquery实现可伸缩搜索框
  • 2017-08-06简单的CSS 下拉导航菜单实现代码
  • 2017-08-06css绘制透明三角形
  • 2017-08-06CSS3中各种颜色属性的使用教程
  • 2017-08-06IE6下Png透明最佳解决方案DD_belatedPNG

文章分类

  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure

最近更新的内容

    • CSS expression在Chrome的问题
    • 如何设置单词字体间距 css设置字体间距样式代码
    • CSS3 绘制BMW logo实的现代码
    • CSS之float在IE浏览器下换行问题解决方法
    • IE6的3像素 bug解决方案分享
    • CSS中针对IE6、7和FF等浏览器的特殊样式写法
    • 制作高效可维护组件化的CSS代码
    • IE10 CSS Hack介绍及IE11的CSS Hack提前了解
    • type=file的inpu美化,自定义上传按钮样式代码
    • css中图片于文本的基线对齐与vertical-align属性设置

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有