CSS简单的页面布局实例

不错 很简单的例子.新手入门用:




index.html

<html>
	<head>
		<title>DIV+CSS简单的页面布局示例</title>
		<link rel="stylesheet" href="class.css" type="text/css" />
	</head>
	<body>
		<div id="container">
			<div id="header">
				<div id="logo" class="bgcolor">LOGO</div>
				<div id="banner">
					<div id="left" class="bgcolor">BANNER1</div>
					<div id="right" class="bgcolor">BANNER2</div>
				</div>
			</div>
			<div class="nav"> </div>
			<div id="menu" class="bgcolor">水平导航条</div>
			<div class="nav"> </div>
			<div id="content">
				<div class="left_box border">栏目(一)</div>
				<div class="right_box border">栏目(二)</div>
				<div class="nav"> </div>
				<div class="left_box">
					<div class="left border">栏目(三)</div>
					<div class="right border">栏目(四)</div>
				</div>
				<div class="right_box">
					<div class="left border">栏目(五)</div>
					<div class="right border">栏目(六)</div>
				</div>
			</div>
			<div id="sidebar">
				<div class="bar border">栏目(七)</div>
				<div class="nav"> </div>
				<div class="bar border">栏目(八)</div>
				<div class="nav"> </div>
				<div class="bar border">栏目(九)</div>
			</div>
			<div class="nav"> </div>
			<div id="footer" class="bgcolor">页脚</div>
		</div>
	</body>
</html>

class.css

/* CSS Document */

body{
	margin:0;
	padding:0;
	text-align:center;
	font:12px Arial,宋体;	
}

.border{
	border:1px solid #888;
}

.bgcolor{
	background:#DDD;
}

#container{
	width:960px;
	margin:0 auto;
}

#header{
	float:left;
	width:100%;
}

#logo{
	float:left;
	width:200px;
	height:80px;
}

#banner{
	float:right;
	width:750px;
}

#banner #left{
	float:left;
	width:540px;
	height:80px;
}

.nav{
	float:left;
	height:10px;
	width:100%;
	overflow:hidden;
	clear:both;
}

#banner #right{
	float:right;
	width:200px;
	height:80px;
}

#menu{
	float:left;
	width:100%;
	height:30px;
}

#sidebar{
	float:right;
	width:200px;
	height:410px;
}

#sidebar .bar{
	float:left;
	width:100%;
	height:130px;
}

#content{
	float:left;
	width:750px;
}

#content .left_box{
	float:left;
	width:370px;
	height:200px;
}

#content .right_box{
	float:right;
	width:370px;
	height:200px;
}

#content .left{
	float:left;
	height:200px;
	width:180px;
}

#content .right{
	float:right;
	height:200px;
	width:180px;
}

#footer{
	float:left;
	width:100%;
	height:60px;
}







  • 3
    点赞
  • 32
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值