尚硅谷前端《梅兰商城CSS》(从9到11)

九. banner区域的结构 + 十. 完成商机市场

js/index.html

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="../css/cssReset.css"/>
	<link rel="stylesheet" href="../css/index.css"/>
	<link rel="stylesheet" href="../css/common.css"/>
</head>
<body>
	<!-- S=页面的顶部 -->
	<div class="top">
		<div class="top_page">
			<div class="top_page_l fl">您好,欢迎来到建材网!</div>
			<div class="top_page_r fr">
				<ul>
					<li><a href="#">建材网首页</a></li>
					<li><a href="#">我的商务室</a><s></s></li>
					<li><a href="#">我的收藏</a><s></s></li>
					<li><a href="#">建材服务</a><s></s></li>
					<li><a href="#">客服中心</a></li>
					<li><a href="#">网站导航</a><s></s></li>
				</ul>
			</div>
		</div>
	</div>
	<!-- E=页面的顶部 -->
	<!-- S=logo -->
	<div class="logo">
		<!-- 这里h1的目的是为了强调 -->
		<h1 class="logo_l fl">梅兰商贸</h1>
		<div class="logo_r fr">
			<div class="logo_r_content">
				<input type="input" value="请输入关键字" class="logo_r_search fl">
				<input type="button" value="搜索" class="logo_r_btn fl">
			</div>
		</div>
	</div>
	<!-- E=logo -->
	<!-- S=导航 -->
	<div class="nav">
		<ul>
			<li><a href="#">首页</a></li>
			<li><a href="#">建筑材料</a></li>
			<li><a href="#">儿童安全座椅</a></li>
			<li><a href="#">工艺美术品</a></li>
		</ul>
	</div>
	<!-- E=导航 -->
	<!-- S=banner -->
	<div class="banner">
		<div class="subNav fl">
			<h2>商机市场</h2>
			<ul>
				<li><s></s><a href="#">建筑材料</a></li>
				<li><s></s><a href="#">儿童安全座椅</a></li>
				<li><s></s><a href="#">工艺美术品</a></li>
				<li><s></s><a href="#">建筑材料</a></li>
				<li><s></s><a href="#">儿童安全座椅</a></li>
				<li><s></s><a href="#">工艺美术品</a></li>
			</ul>
		</div>
		<div class="ad fl"></div>
		<div class="message fr"></div>
	</div>
	<!-- E=banner -->
</body>
</html>

css/index.css

@charset "UTF-8";
html {
	font: 12px '宋体';
}

a {
	color: #000;
}

.top {
	background-color: #F7F7F7;
	height: 26px;
	border-bottom: 1px solid #D8D8D8;
}

.top_page {
	width: 970px;
	height: 26px;
	margin: 0 auto;
}

.top_page_l{
	line-height: 26px;
}

.top_page_r ul li {
	line-height: 26px;
	float: left;
	padding-right: 10px;
}

.top_page_r ul li s {
	width: 18px;
	height: 14px;
	background: url(../image/sprite.png);
	display: inline-block;
	vertical-align: -3px;
}


.logo {
	width: 970px;
	height: 98px;
	/*center*/
	margin: 0 auto;
}

.logo_l {
	width: 200px;
	height: 55px;
	background: blue;
	margin: 24px 0 19px 9px;
	background: url(../image/sprite.png) -20px 0;
	/*	这里是为了让“梅兰商贸”几个字,用户不可见,但爬虫可见,提高被搜索引擎爬取的概率*/
	text-indent: -1000em;
}

.logo_r {
	width: 530px;
	height: 42px;
	border: 1px solid #C9C9C9;
	margin-top: 29px;
}

.logo_r_content {
	margin:5px 5px 5px 4px;
}

.logo_r_search {
	width: 418px;
	height: 28px;
	border: 1px solid #C9C9C9;
	color: #999999;
}

.logo_r_btn {
	width: 99px;
	height: 30px;
	color: white;
	background-color: #2F70D0;
}

.nav {
	width: 970px;
	height: 25px;
	margin: 0 auto;
	border-bottom: 2px solid #0266A3;
}
.nav li {
	padding: 0 15px 0 15px;
	line-height: 25px;
	float: left;
	font-size: 14px;
	font-weight: bold;
}

.nav li a {
	color: #0266A3;
}

.nav li:hover {
	background-color: #0266A3;
}

.nav li:hover a {
	color: white;
}

.banner {
	width: 970px;
	height: 210px;
	margin: 0 auto;
	margin-top: 10px;
}

.subNav {
	width: 200px;
	height: 210px;
	margin-right: 11px;
	background-color: #E8F0F8;
}

.ad {
	width: 520px;
	height: 210px;
	background-color: yellow;
}

.message {
	width: 230px;
	height: 210px;
	background-color: blue;
}

.subNav h2 {
	padding-left: 20px;
	height: 30px;
	line-height: 30px;
	font-size: 14px;
	font-weight: bold;
	background-color: #0266A3;
	color: white;
}

.subNav s {
	display: inline-block;
	width: 15px;
	height: 13px;
	background: url(../image/sprite.png) -212px 0;
	vertical-align: middle;
}

.subNav li {
	font-size: 15px;
	padding-top: 11px;
	margin-left: 9px;
}

.subNav li a {
	padding-left: 15px;
}

最终效果图

注意: 这里Chrome里有个插件,叫做ColorZilla, 可以对网页上的各像素点,进行类似PS的取色

 十一. 完成详细信息

js/index.html

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="../css/cssReset.css"/>
	<link rel="stylesheet" href="../css/index.css"/>
	<link rel="stylesheet" href="../css/common.css"/>
</head>
<body>
	<!-- S=页面的顶部 -->
	<div class="top">
		<div class="top_page">
			<div class="top_page_l fl">您好,欢迎来到建材网!</div>
			<div class="top_page_r fr">
				<ul>
					<li><a href="#">建材网首页</a></li>
					<li><a href="#">我的商务室</a><s></s></li>
					<li><a href="#">我的收藏</a><s></s></li>
					<li><a href="#">建材服务</a><s></s></li>
					<li><a href="#">客服中心</a></li>
					<li><a href="#">网站导航</a><s></s></li>
				</ul>
			</div>
		</div>
	</div>
	<!-- E=页面的顶部 -->
	<!-- S=logo -->
	<div class="logo">
		<!-- 这里h1的目的是为了强调 -->
		<h1 class="logo_l fl">梅兰商贸</h1>
		<div class="logo_r fr">
			<div class="logo_r_content">
				<input type="input" value="请输入关键字" class="logo_r_search fl">
				<input type="button" value="搜索" class="logo_r_btn fl">
			</div>
		</div>
	</div>
	<!-- E=logo -->
	<!-- S=导航 -->
	<div class="nav">
		<ul>
			<li><a href="#">首页</a></li>
			<li><a href="#">建筑材料</a></li>
			<li><a href="#">儿童安全座椅</a></li>
			<li><a href="#">工艺美术品</a></li>
		</ul>
	</div>
	<!-- E=导航 -->
	<!-- S=banner -->
	<div class="banner">
		<div class="subNav fl">
			<h2>商机市场</h2>
			<ul>
				<li><s></s><a href="#">建筑材料</a></li>
				<li><s></s><a href="#">儿童安全座椅</a></li>
				<li><s></s><a href="#">工艺美术品</a></li>
				<li><s></s><a href="#">建筑材料</a></li>
				<li><s></s><a href="#">儿童安全座椅</a></li>
				<li><s></s><a href="#">工艺美术品</a></li>
			</ul>
		</div>
		<div class="ad fl"></div>
		<div class="message fr">
			<div class="message_top">
				<p class="fw">建材通大众版</p>
				<s class="fl"></s>
				<p class="ch fl">价格实惠,量身为预算不多</br>的供应商所设。<a href="#">了解详情</a></p>
			</div>
			<div class="message_bottom">
				<p class="findMessage">找信息或者发信息遇到问题?</p>
				<p class="phone"><s></s>0124-97342354</p>
				<input type="button" class="btn">
			</div>
		</div>
	</div>
	<!-- E=banner -->
</body>
</html>

css/index.css

@charset "UTF-8";
html {
	font: 12px '宋体';
}

a {
	color: #000;
}

.top {
	background-color: #F7F7F7;
	height: 26px;
	border-bottom: 1px solid #D8D8D8;
}

.top_page {
	width: 970px;
	height: 26px;
	margin: 0 auto;
}

.top_page_l{
	line-height: 26px;
}

.top_page_r ul li {
	line-height: 26px;
	float: left;
	padding-right: 10px;
}

.top_page_r ul li s {
	width: 18px;
	height: 14px;
	background: url(../image/sprite.png);
	display: inline-block;
	vertical-align: -3px;
}


.logo {
	width: 970px;
	height: 98px;
	/*center*/
	margin: 0 auto;
}

.logo_l {
	width: 190px;
	height: 55px;
	background: blue;
	margin: 24px 0 19px 9px;
	background: url(../image/sprite.png) -20px 0;
	/*	这里是为了让“梅兰商贸”几个字,用户不可见,但爬虫可见,提高被搜索引擎爬取的概率*/
	text-indent: -1000em;
}

.logo_r {
	width: 530px;
	height: 42px;
	border: 1px solid #C9C9C9;
	margin-top: 29px;
}

.logo_r_content {
	margin:5px 5px 5px 4px;
}

.logo_r_search {
	width: 418px;
	height: 28px;
	border: 1px solid #C9C9C9;
	color: #999999;
}

.logo_r_btn {
	width: 99px;
	height: 30px;
	color: white;
	background-color: #2F70D0;
}

.nav {
	width: 970px;
	height: 25px;
	margin: 0 auto;
	border-bottom: 2px solid #0266A3;
}
.nav li {
	padding: 0 15px 0 15px;
	line-height: 25px;
	float: left;
	font-size: 14px;
	font-weight: bold;
}

.nav li a {
	color: #0266A3;
}

.nav li:hover {
	background-color: #0266A3;
}

.nav li:hover a {
	color: white;
}

.banner {
	width: 970px;
	height: 210px;
	margin: 0 auto;
	margin-top: 10px;
}

.subNav {
	width: 200px;
	height: 210px;
	margin-right: 11px;
	background-color: #E8F0F8;
}

.ad {
	width: 520px;
	height: 210px;
	background: url(../image/material.jpg);
}

.message {
	width: 230px;
	height: 210px;
}

.subNav h2 {
	padding-left: 20px;
	height: 30px;
	line-height: 30px;
	font-size: 14px;
	font-weight: bold;
	background-color: #0266A3;
	color: white;
}

.subNav s {
	display: inline-block;
	width: 15px;
	height: 13px;
	background: url(../image/sprite.png) -212px 0;
	vertical-align: middle;
}

.subNav li {
	font-size: 15px;
	padding-top: 11px;
	margin-left: 9px;
}

.subNav li a {
	padding-left: 15px;
}

.message_top {
	height: 95px;
	boreder: 1px solid #DDDDDD;
	background: #f7faff;
	margin-bottom: 21px;
}

.message_top s {
	margin: 20px 10px 0 10px;
	display: inline-block;
	height: 44px;
	width: 44px;
	background: url(../image/sprite.png) -229px 0;
}

.message_top .fw {
	font-weight: bold;
	padding: 7px 0 0 18px;
}

.message_top .ch {
	margin-top: 25px;
}

.message_bottom {
	height: 94px;
	background: #f7faff;
}

.message_bottom .findMessage {
	text-align: center;
	font-size: 14px;
	padding-top: 11px;
}

.message_bottom .phone {
	margin-top: 10px;
	text-align: center;
	color: #3F9CE0;
	font-size: 14px;
}

.message_bottom .phone s{
	/*设置宽高之前,一定要设置如下这行*/
	display: inline-block;
	width: 14px;
	height: 17px;
	background: url(../image/sprite.png) -274px 0;
	vertical-align: middle;
	margin-right: 6px;
}

.message_bottom .btn {
	width: 85px;
	height: 23px;
	background: url(../image/sprite.png) -300px -3px;
	margin-top: 9px;
	margin-left: 75px;
}

 效果图

猜你喜欢

转载自blog.csdn.net/garrulousabyss/article/details/82597766
今日推荐