版心和布局流程


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

布局流程

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

  1. 确定页面的版心(可视区)
  2. 分析页面中的行模块,以及每个行模块中间的列模块。
  3. 制作HTML页面,CSS文件。
  4. CSS初始化,然后开始运用盒子模型的原理,通过DIV+CSS布局来控制网页的各个模块。

一列固定宽度皆居中

在这里插入图片描述


<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <style>
		* {
			margin: 0;
			padding: 0;  /* 清除内外边距 css 第一讲句话 */
		}
		/* 相同的样式,我们会想到 并集选择器 */
		.top,
		.banner,
		.main,
		.footer {
			width: 960px;
			text-align: center; /* 文字居中对齐 */
			margin: 0 auto; /* 可以让盒子居中对齐  只要保证 左右auto就阔以了 */
			margin-bottom: 10px;
			border: 1px dashed #ccc;
		}
		.top {		
			height: 80px;
			background-color: pink;									
		}
		.banner {
			height: 120px;
			background-color: purple;
		}
		.main {
			height: 150px;
			background-color: hotpink;
		}
		.footer {
			height: 250px;
			background-color: black;
		}
        </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>

两列做窄右宽型

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
	*{
		margin: 0;
		padding: 0;
	}
	.top,
	.banner,
	.main,
	.fotter{
		width: 960px;
		margin: 0 auto;
		border: 1px dashed red;
		text-align: center;
		background-color: pink;
	}
	.top{
		height: 80px;
	}
	.banner{
		height: 100px;
	}
	.main{
		height: 140px;
	}
	.left{
		width: 360px;
		height: 140px;
		background-color: hotpink;
		float: left;
	}
	.right{
		width: 592px;
		height: 140px;
		background-color: hotpink;
		float: right;
	}
	.fotter{
		height: 200px;
	}
	</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="fotter">fotter</div>
</body>
</html>

通栏平均分布型

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
	* {
		margin: 0;
		padding: 0;
	}
	.top{
		/* 通栏的盒子,可以不用写宽度,默认的宽度和浏览器一样宽 */
		height: 80px;
		border: 1px dashed #aaa;
		background-color: #eee;
		text-align: center;
	}
	.banner{
		width: 960px;
		height: 100px;
		border: 1px dashed #aaa;
		background-color: #eee;
		text-align: center;
		margin: 10px auto;

	}
	.small{
		width: 960px;
		height: 80px;
		background-color: #eee;
		margin: 10px auto;
	}
	ul{
		list-style: none;
	}
	.small ul li{
		width: 230px;
		height: 80px;
		border: 1px dashed #aaa;
		background-color: pink;
		float: left;
		margin-left: 10px;
	}
	.small .no{
		margin-left: 0;/* 权重问题 */
	}
	.fotter{
		height: 100px;
		border: 1px dashed #aaa;
		background-color: #eee;
		text-align: center;
	}
	</style>
</head>
<body>
	<div class="top">通栏的顶部</div>
	<div class="banner">广告条</div>
	<div class="small">
		<ul>
			<li class="no">1</li>
			<li>2</li>
			<li>3</li>
			<li>4</li>
		</ul>
	</div>
	<div class="small">
		<ul>
			<li class="no">1</li>
			<li>2</li>
			<li>3</li>
			<li>4</li>
		</ul>
	</div>
	<div class="small">
		<ul>
			<li class="no">1</li>
			<li>2</li>
			<li>3</li>
			<li>4</li>
		</ul>
	</div>
	<div class="fotter"></div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值