CSS学习11--版心和布局流程以及几种分布的例子

一、版心

版心:是指网页主题内容所在的区域。一般在浏览器窗口水平居中位置,常见的宽度值为960px、980px、1000px、1200px等。

二、布局流程

为了提高网页制作的效率,布局时需要遵守一定的布局流程,具体如下:

  • 确定页面版心
  • 分析页面中的行模块,以及每个行模块中的列模块
  • 制作HTML结构
  • CSS初始化,然后开始运用盒子模型的原理,通过CID+CSS布局来控制网页的各个模块

三、一列固定宽度且居中

<html>
	<head>
		<style>
		* {
			padding: 0;
			margin: 0;
		}
		.top,
		.banner,
		.main,
		.footer {
			width: 960px;
			margin: 10px auto;
			text-align: center;
		}
		.top {
			height: 100px;
			background-color: pink;
		}
		.banner {
			height: 120px;
			background-color: skyblue;
		}
		.main {
			height: 500px;
			background-color: red;
		}
		.footer {
			height: 150px;
			background-color: #ccc;
		}
		</style>
	</head>
	<body>
		<div class="top">top</div>
		<div class="banner">banner</div>
		<div class="main">main</div>
		<div class="footer">footer</div>
	</body>
</html>

四、两列左窄右宽

<html>
	<head>
		<style>
		* {
			padding: 0;
			margin: 0;
		}
		.top,
		.banner,
		.main,
		.footer {
			width: 960px;
			margin: 10px auto;
			text-align: center;
		}
		.top {
			height: 100px;
			background-color: pink;
		}
		.banner {
			height: 120px;
			background-color: skyblue;
		}
		.main {
			height: 500px;
			background-color: red;
		}
		.footer {
			height: 150px;
			background-color: #ccc;
		}
		.main .left {
			width: 360px;
			height: 500px;
			float: left;
			background-color: white;
		}
		.main .right {
			width: 590px;
			height: 500px;
			margin-left: 10px;
			float: left;
			background-color: white;
		}
		</style>
	</head>
	<body>
		<div class="top">top</div>
		<div class="banner">banner</div>
		<div class="main">
			<div class="left">left</div>
			<div class="right">right</div>
		</div>
		<div class="footer">footer</div>
	</body>
</html>

五、通栏平均分布型

<html>
	<head>
		<style>
		* {
			padding: 0;
			margin: 0;
		}
		ul {
			list-style: none;
		}
		.top,
		.banner,
		.main,
		.footer {
			width: 960px;
			margin: 10px auto;
			text-align: center;
		}
		.top {
			height: 100px;
			background-color: pink;
		}
		.banner {
			height: 120px;
			background-color: skyblue;
		}
		.main {
			height: 500px;
			background-color: red;
		}
		.footer {
			height: 150px;
			background-color: #ccc;
		}
		.main ul li:nth-child(odd) {
			width: 240px;
			height: 240px;
			background-color: deeppink;
			float: left;
		}
		.main ul li:nth-child(even) {
			width: 240px;
			height: 240px;
			background-color: hotpink;
			float: left;
		}
		</style>
	</head>
	<body>
		<div class="top">top</div>
		<div class="banner">banner</div>
		<div class="main">
			<ul>
				<li>1</li>
				<li>2</li>
				<li>3</li>
				<li>4</li>
			</ul>
		</div>
		<div class="footer">footer</div>
	</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值