请帮我写一个简单的DIV+CSS网页布局例子

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了请帮我写一个简单的DIV+CSS网页布局例子相关的知识,希望对你有一定的参考价值。

浏览器:IE6
要求:
有4个DIV层·DIV1,DIV2,DIV3,DIV4
DIV1为DIV2,3,4的父层·
DIV2,3,4在DIV1中按左中右排列为3列·

参考技术A 楼上的也太复杂了,什么都贴出来了?—

页面
代码
<div
class="content">
<div
class="left"></div>
<div
class="mid"></div>
<div
class="right"></div>
</div>
css文件
.content
width:800px;
magin:0
auto;

.left
float:left;
.mid
float:left
.right
float:left
参考技术B 楼上的也太复杂了,什么都贴出来了?— —

页面代码
<div class="content">
<div class="left"></div>
<div class="mid"></div>
<div class="right"></div>
</div>
css文件
.content
width:800px;
magin:0 auto;

.left
float:left;
.mid
float:left
.right
float:left本回答被提问者采纳
参考技术C <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
.contentwidth:600px; height:400px; border:1px solid #000;
.a float:left; width:200px; height:400px; background:#F00;
.b float:left; width:200px; height:400px; background: #FF0;
.c float:left; width:200px; height:400px; background: #3F0;
</style>
</head>

<body>
<div class="content">
<div class="a"></div>
<div class="b"></div>
<div class="c"></div>
</div>
</body>
</html>
参考技术D CSS

/*基本信息*/
body font:12px Tahoma;background:#CCCCCC;/*适用于页面整体:字体及字体大小,页面页边距全部设置为0,文字对齐方式为居中,背景颜色*/
* margin:0; padding:0; border:0;/*全局设定,外边距,内边距和表格边框全部为0*/
html,body height:100%; /*全局设定高度为100%*/
/*--------------------------------------*/
/*页面主体*/
#pagebody
width:780px; /*设定宽度*/
margin:0px auto; /*居中*/

#mainleft
width:192px; /*设定宽度*/
float:left; /*浮动居左*/
clear:left; /*不允许左侧存在浮动*/
overflow:hidden; /*超出宽度部分隐藏*/
border:1px solid #006699;
margin:5px auto;
height:auto;

#mainright
width:580px;
text-align:left;
float:right; /*浮动居右*/
clear:right; /*不允许右侧存在浮动*/
overflow:hidden;
border:0px solid #E00;/*初始使用表格,留存使用*/
margin:5px auto;

#mainright2
width:578px;
float:right; /*浮动居右*/
clear:right; /*不允许右侧存在浮动*/
overflow:hidden;
border:0px solid #006699;
margin:2px auto;
height:auto;

#mainright3
width:285px; /*设定宽度*/
float:left; /*浮动居左*/
clear:left; /*不允许左侧存在浮动*/
overflow:hidden; /*超出宽度部分隐藏*/
border:1px solid #006699;
margin:2px auto;
height:auto;

#mainright4
width:285px; /*设定宽度*/
float:right; /*浮动居左*/
clear:right; /*不允许左侧存在浮动*/
overflow:hidden; /*超出宽度部分隐藏*/
border:1px solid #006699;
margin:2px auto;
height:auto;


/*字体设置*/
#biaoti
font-size:10px;
font-weight:bold;
padding-left:10px;
color:#FFf;
background-color:#006699;
height:20px;


页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="pagebody"><!--页面主体-->
<div id="mainleft">
左侧显示
</div><!--左侧关闭-->
<div id="mainright2">
<div id="mainright3">
右侧一显示
</div>
<div id="mainright4">
右侧二显示
</div>
</div>
</div>
</body>
</html>

请帮我写一段JS代码,当滚动到页面距离底部100px的时候触发点击#div1?

蟹蟹

var flag = true;
$(window).scroll(function ()
var me = $(this), div1 = $(\'#div1\');
var scrollTop = me.scrollTop();
var scrollHeight = $(document).height();
var windowHeight = me.height();
if(((scrollHeight - scrollTop - windowHeight) <= 100) && flag)
div1.click();
flag = false;
else
flag = true;

);
参考技术A 没有学过编程,不会写这个代码。 参考技术B 不好意思,我写不了这样的接js代码。帮不了你,不好意思,文化有限。

以上是关于请帮我写一个简单的DIV+CSS网页布局例子的主要内容,如果未能解决你的问题,请参考以下文章

一个简单的模板了解css+div网页布局

网页设计中采用div+css布局,这里的DIV是啥意思?

PHP.3-DIV+CSS标准网页布局准备工作(上)

div css布局网页如何实现网页自动适应屏幕高度和宽度

为啥要用div+css来进行网页布局?

怎样才能用div和css把网页布局的很美观?