目录
1.品优购项目规划
1.1网站制作流程

1.2品优购项目整体介绍
- 项目名称:品优购
- 项目描述:品优购是一个电商网站,我们要完成PC端首页、列表页、注册页面的制作



1.3品优购项目的学习目的

1.4开发工具以及技术栈

小总结
1.5品优购项目搭建工作、
1.5.1创建文件夹

1.5.2创建文件
第二种方式直接找到十几种样式,效率更高,但是第一种也可以接受,比如京东就是用第一种
base.css文件 - CSS初始化代码:
/* 所有标签的内外边距清零 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* em 和 i 斜体的文字不倾斜 */
em,
i {
font-style: normal
}
/* 去掉 li 的小圆点 */
li {
list-style: none
}
img {
/* border 0 照顾低版本浏览器 如果图片外面包含了链接会有边框的问题 */
border: 0;
/* 取消图片底侧有空白缝隙的问题 */
vertical-align: middle
}
button {
/* 当鼠标经过button 按钮的时候,鼠标变成小手 */
cursor: pointer
}
a {
color: #666;
text-decoration: none
}
a:hover {
color: #c81623
}
button,
input {
/* "\5B8B\4F53" 就是宋体的意思 这样浏览器兼容性比较好 */
font-family: Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif
}
body {
/* 抗锯齿形 让文字显示的更加清晰 */
-webkit-font-smoothing: antialiased;
background-color: #fff;
font: 12px/1.5 Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif;
color: #666
}
.hide,
.none {
display: none
}
/* 清除浮动 */
.clearfix:after {
visibility: hidden;
clear: both;
display: block;
content: ".";
height: 0
}
.clearfix {
*zoom: 1
}
1.5.3 模块化开发


例如:

1.6网站 favicon 图标
favicon.ico一般用于作为缩略的网站标志,他显示在浏览器的地址栏或者标签上。
目前主要的浏览器都支持 favicon.ico图标

第一步:
1.把品优购图标切成png图片
2.把png图片转化为ico图标,这需要借助于第三方转换网站,例如比特虫:http://www.bitbug.net/
第二步:
favicon图标放到网站根目录下

第三步:
在html页面的<head></head>元素之间引入代码
<link rel="shortcut icon" href="favicon.ico" />
<!-- 注意href引入的文件名字与ico文件相同 -->
总结:

1.7网站TDK三大标签SEO优化

1.7.1title网站标题

1.7.2description网站说明

1.7.3keywords关键字

第一阶段-项目规划参考代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>品优购商城-正品低价、品质保障、配送及时、轻松购物!</title>
<link rel="shortcut icon" href="favicon.ico" />
<!-- 网站说明 -->
<meta name="description" content="京东JD.COM-专业的综合网上购物商城,为您提供正品低价的购物选择、优质便捷的服务体验。商品来自全球数十万品牌商家,囊括家电、手机、电脑、服装、居家、母婴、美妆、个护、食品、生鲜等丰富品类,满足各种购物需求。">
<!-- 关键字 -->
<meta name="Keywords" content="网上购物,网上商城,家电,手机,电脑,服装,居家,母婴,美妆,个护,食品,生鲜,京东">
<!-- 引入我们初始化样式文件 -->
<link rel="stylesheet" href="css/base.css">
<!-- 引入我们公共的样式文件 -->
<link rel="stylesheet" href="css/common.css">
</head>
<body>
123
</body>
</html>
2.品优购首页制作
网站的首页一般都是使用index命名,比如index.html 或者 index.php。
我们开始制作首页的头部和底部的时候,根据模块化开发,样式要写到common.css里面
2.1常用模块类名命名

2.2快捷导航shortcut制作
启发:
1.设置.style_red样式给左侧 '免费注册' 是因为模块中不只有它是这种红色样式(例如搜索框下面的 ' 优惠购首发' ),设置单独一个类名更加合理方便

2. 借鉴右侧导航栏做法,设置13个li ,给偶数小li设置样式实现 ' | ' 分隔,而不是用border(高度不一致麻烦)
3.右侧导航栏中的字体图标采用after伪元素,注意字体图标路径(见common.css文件)
===快捷导航shortcut制作完成代码展示===
index.html
<div class="shortcut">
<div class="w">
<div class="fl">
<ul>
<li>品优购欢迎您! </li>
<li><a href="#">请登录</a> <a href="#" class="style_red">免费注册</a></li>
</ul>
</div>
<div class="fr">
<ul>
<li>我的订单</li>
<li></li>
<li class="arrow-icon">我的品优购</li>
<li></li>
<li>品优购会员</li>
<li></li>
<li>企业采购</li>
<li></li>
<li class="arrow-icon">关注品优购</li>
<li></li>
<li class="arrow-icon">客户服务</li>
<li></li>
<li class="arrow-icon">网站导航</li>
</ul>
</div>
</div>
</div>
common.css
/* 声明字体图标 这里一定要注意路径的变化 */
@font-face {
font-family: 'icomoon';
src: url('../fonts/icomoon.eot?rxsste');
src: url('../fonts/icomoon.eot?rxsste#iefix') format('embedded-opentype'), url('../fonts/icomoon.ttf?rxsste') format('truetype'), url('../fonts/icomoon.woff?rxsste') format('woff'), url('../fonts/icomoon.svg?rxsste#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
/* 版心 */
.w {
width: 1200px;
margin: 0 auto;
}
.fl {
float: left;
}
.fr {
float: right;
}
.style_red {
color: #e33333;
}
/* 快捷导航栏 */
.shortcut {
height: 31px;
line-height: 31px;
background-color: #f1f1f1;
}
.shortcut ul li {
float: left;
}
/* 选择所有的偶数的li */
.shortcut .fr ul li:nth-child(even) {
margin: 9px 15px 0;
width: 1px;
height: 12px;
background-color: #666;
}
.arrow-icon::after {
font-family: 'icomoon';
content: '';
margin-left: 6px;
}
2.3header制作

2.3.1LOGO SEO优化
logo我们以前的做法div里面放图片是不合理的,实际开发中应该用到SEO优化

LOGO SEO优化代码完成展示
index.html
<!-- logo模块 -->
<div class="logo">
<h1>
<a href="index.html" title="品优购商城">品优购商城</a>
</h1>
</div>
common.css
.logo {
position: absolute;
/* 图片有出入,手动调整 */
top: 18px;
left: -17px;
width: 209px;
height: 68px;
}
.logo a {
display: block;
width: 209px;
height: 68px;
background: url(../images/pinyou.com.png) no-repeat;
/* font-size: 0;京东的做法 */
/* 淘宝的做法让文字隐藏 */
text-indent: -999px;
overflow: hidden;
}
2.3.2 搜索框模块

搜索框测量大盒子定位数据时,因为用的CSS3盒子模型,边框是不会撑大盒子的,因此测量宽度高度的时候直接把边框量进去就是最终的宽度/高度了
参考搜索框做法大盒子包裹住search表单和button按钮,注意search表单和button按钮都是行内元素,会有间隙,卡好宽度的时候容易掉下来 可以用浮动去除。
搜索框模块代码完成展示
index.html
<!-- search搜索模块 -->
<div class="search">
<input type="search" name="" id="" placeholder="语言开发">
<button href="#">搜索</button>
</div>
common.css
.search {
position: absolute;
top: 25px;
right: 315px;
width: 538px;
height: 36px;
border: 2px solid #b1191a;
}
.search input {
float: left;
width: 454px;
height: 32px;
padding-left: 10px;
}
.search button {
float: left;
width: 80px;
height: 32px;
background-color: #b1191a;
font-size: 16px;
color: white;
}
2.3.3hotwords热词模块
indedx.html
<!-- 热点词模块 -->
<div class="hotwords">
<ul>
<!-- 实际要写成a链接 -->
<li class="style_red">优惠购首发</li>
<li>亿元优惠</li>
<li>9.9团购</li>
<li>每满99减30</li>
<li>办公用品</li>
<li>电脑</li>
<li>通信</li>
</ul>
</div>
common.css
.hotwords {
position: absolute;
top: 61px;
right: 315px;
width: 538px;
height: 25px;
}
.hotwords ul li {
float: left;
margin: 0 12px;
color: #666;
line-height: 25px;
}
2.3.4shopcar模块
(自己用了shopcar模块用a链接转换成块元素) 加上css伪类元素::before和::after添加文字图标
购物车商品数量count用定位
===header制作完成展示===
效果:

index.html
<!-- header头部模块start -->
<header class="header w">
<!-- logo模块 -->
<div class="logo">
<h1>
<a href="index.html" title="品优购商城">品优购商城</a>
</h1>
</div>
<!-- search搜索模块 -->
<div class="search">
<input type="search" name="" id="" placeholder="语言开发">
<button href="#">搜索</button>
</div>
<!-- 热点词模块 -->
<div class="hotwords">
<ul>
<!-- 实际要写成a链接 -->
<li class="style_red">优惠购首发</li>
<li>亿元优惠</li>
<li>9.9团购</li>
<li>每满99减30</li>
<li>办公用品</li>
<li>电脑</li>
<li>通信</li>
</ul>
</div>
<!-- 购物车模块 -->
<a href="#" class="shopcar">我的购物车</a>
<i class="count">8</i>
</header>
<!-- header头部模块end -->
common.css
/* header头部模块 */
.header {
position: relative;
height: 105px;
}
.logo {
position: absolute;
/* 图片有出入,手动调整 */
top: 18px;
left: -17px;
width: 209px;
height: 68px;
}
.logo a {
display: block;
width: 209px;
height: 68px;
background: url(../images/pinyou.com.png) no-repeat;
/* font-size: 0;京东的做法 */
/* 淘宝的做法让文字隐藏 */
text-indent: -999px;
overflow: hidden;
}
.search {
position: absolute;
top: 25px;
right: 315px;
width: 538px;
height: 36px;
border: 2px solid #b1191a;
}
.search input {
float: left;
width: 454px;
height: 32px;
padding-left: 10px;
}
.search button {
float: left;
width: 80px;
height: 32px;
background-color: #b1191a;
font-size: 16px;
color: white;
}
.hotwords {
position: absolute;
top: 61px;
right: 315px;
width: 538px;
height: 25px;
}
.hotwords ul li {
float: left;
margin: 0 12px;
color: #666;
line-height: 25px;
}
.shopcar {
display: block;
position: absolute;
top: 25px;
right: 65px;
width: 138px;
height: 33px;
line-height: 33px;
text-align: center;
background-color: #f7f7f7;
border: 1px solid #dfdfdf;
}
.shopcar:before {
content: '\e93a';
font-family: 'icomoon';
margin-right: 5px;
color: #b1191a;
}
.shopcar:after {
content: '\e901';
font-family: 'icomoon';
margin-left: 10px;
}
.count {
position: absolute;
top: 22px;
/* 用left定位购买数量,数量比较大时数目会往右走更合理 */
left: 1100px;
padding: 0 5px;
height: 14px;
line-height: 14px;
text-align: center;
color: #fff;
background-color: #e60012;
border-radius: 7px 7px 7px 0;
}
2.4 nav导航栏模块
效果:
制作:

===nav导航栏模块代码展示===
index.html
<!-- nav导航部分start -->
<nav class="nav">
<div class="w">
<div class="dropdown">
<div class="dt">全部商品分类</div>
<div class="dd">
<ul>
<li><a href="#">家用电器</a></li>
<li><a href="#">手机、数码、通信</a></li>
<li><a href="#">电脑、办公</a></li>
<li><a href="#">家居、家具、家装、厨具</a></li>
<li><a href="#">男装、女装、童装、内衣</a></li>
<li><a href="#">鞋靴、箱包、珠宝、奢侈品</a></li>
<li><a href="#">运动户外、钟表</a></li>
<li><a href="#">汽车、汽车用品</a></li>
<li><a href="#">食品、酒类、生鲜、特产</a></li>
<li><a href="#">医药保健</a></li>
<li><a href="#">图书、音像、电子书</a></li>
<li><a href="#">彩票、旅行、充值、票务</a></li>
<li><a href="#">理财、众筹、白条、保险</a></li>
<li><a href="#">个户化妆、清洁用品、宠物</a> </li>
<li><a href="#">母婴、玩具乐器</a> </li>
</ul>
</div>
</div>
<div class="navitems">
<ul>
<li><a href="#">服装城</a></li>
<li><a href="#">美妆馆</a></li>
<li><a href="#">传智超市</a></li>
<li><a href="#">全球购</a></li>
<li><a href="#">闪购</a></li>
<li><a href="#">团购</a></li>
<li><a href="#">拍卖</a></li>
<li><a href="#">有趣</a></li>
</ul>
</div>
</div>
</nav>
<!-- nav导航部分end -->
common.css
/* nav导航模块 */
.nav {
height: 47px;
line-height: 47px;
border-bottom: 2px solid #b1191a;
}
.nav>div {
height: 100%;
}
.dropdown {
float: left;
width: 210px;
height: 513px;
color: #fff;
}
.dt {
font-size: 16px;
background-color: #b1191a;
text-align: center;
}
.dd {
width: 100%;
height: 465px;
border-left: 1px solid #c81623;
background-color: #c81623;
}
.dropdown .dd ul li {
position: relative;
line-height: 31px;
height: 31px;
}
.dropdown .dd ul li a {
display: block;
padding-left: 9px;
font-size: 14px;
color: #fff;
}
.dropdown .dd ul li a:hover {
background-color: #fff;
color: #cb343c;
}
.dropdown .dd ul li a::after {
position: absolute;
right: 10px;
content: '\e900';
font-family: 'icomoon';
}
.navitems ul li {
float: left;
}
.navitems ul li a {
display: block;
height: 47px;
line-height: 47px;
padding: 0 25px;
font-size: 16px;
}
2.5footer底部制作


===footer底部制作完成展示===
效果:

制作:
index.html
<!-- 底部模块start -->
<footer class="footer">
<div class="w">
<!-- 服务模块 -->
<div class="mod_service">
<div class="img1"><img src="../shoping/images/fuwu.png" alt=""></div>
<div class="img2"><img src="../shoping/images/su.png" alt=""></div>
<div class="img3"><img src="../shoping/images/shouhou.png" alt=""></div>
<div class="img4"><img src="../shoping/images/zheng.png" alt=""></div>
<div class="img5"><img src="../shoping/images/图层142.png" alt=""></div>
</div>
<!-- 帮助模块 -->
<div class="mod_help">
<dl>
<dt>购物指南</dt>
<dd><a href="#">购物流程</a></dd>
<dd><a href="#">会员介绍</a></dd>
<dd><a href="#">生活旅行/团购</a></dd>
<dd><a href="#">常见问题</a></dd>
<dd><a href="#">大家电</a></dd>
<dd><a href="#">联系客服</a></dd>
</dl>
<dl>
<dt>购物指南</dt>
<dd><a href="#">购物流程</a></dd>
<dd><a href="#">会员介绍</a></dd>
<dd><a href="#">生活旅行/团购</a></dd>
<dd><a href="#">常见问题</a></dd>
<dd><a href="#">大家电</a></dd>
<dd><a href="#">联系客服</a></dd>
</dl>
<dl>
<dt>购物指南</dt>
<dd><a href="#">购物流程</a></dd>
<dd><a href="#">会员介绍</a></dd>
<dd><a href="#">生活旅行/团购</a></dd>
<dd><a href="#">常见问题</a></dd>
<dd><a href="#">大家电</a></dd>
<dd><a href="#">联系客服</a></dd>
</dl>
<dl>
<dt>购物指南</dt>
<dd><a href="#">购物流程</a></dd>
<dd><a href="#">会员介绍</a></dd>
<dd><a href="#">生活旅行/团购</a></dd>
<dd><a href="#">常见问题</a></dd>
<dd><a href="#">大家电</a></dd>
<dd><a href="#">联系客服</a></dd>
</dl>
<dl>
<dt>购物指南</dt>
<dd><a href="#">购物流程</a></dd>
<dd><a href="#">会员介绍</a></dd>
<dd><a href="#">生活旅行/团购</a></dd>
<dd><a href="#">常见问题</a></dd>
<dd><a href="#">大家电</a></dd>
<dd><a href="#">联系客服</a></dd>
</dl>
<dl>
<dt>帮助中心</dt>
<dd><img src="../shoping/images/多边形1拷贝.png" alt=""></dd>
品优购客户端
</dl>
</div>
<!-- 版权模块 -->
<div class="mod_copyright">
<div class="links"> <a href="">关于我们</a> | <a href="#">联系我们</a> | <a href="#">联系客服</a> | <a href="#">商家入驻</a> | <a href="#">营销中心</a> | <a href="#">手机品优购</a> | <a href="#">友情链接</a> | <a href="#">销售联盟</a> | <a href="#">品优购社区</a> | <a href="#">品优购公益</a> |
<a
href="#">English Site</a> | <a href="#">Contact U</a></div>
<div class="copyright">地址:北京市昌平区建材城西路金燕龙办公楼一层 邮编:100096 电话:400-618-4000 传真:010-82935100 邮箱: zhanghj+itcast.cn<br> 京ICP备08001421号京公网安备110108007702
</div>
</div>
</div>
</footer>
<!-- 底部模块end -->
common.css
/* footer模块制作 */
.footer {
position: relative;
top: 600px;
height: 415px;
padding-top: 30px;
background-color: #f5f5f5;
}
.mod_service {
position: relative;
width: 100%;
height: 80px;
border-bottom: 1px solid #ccc;
}
.img1 {
position: absolute;
left: 38px;
}
.img2 {
position: absolute;
left: 280px;
}
.img3 {
position: absolute;
left: 528px;
}
.img4 {
position: absolute;
left: 762px;
}
.img5 {
position: absolute;
left: 1015px;
}
.mod_help {
padding-top: 20px;
padding-left: 50px;
height: 185px;
border-bottom: 1px solid #ccc;
}
.mod_help dl {
float: left;
width: 200px;
}
.mod_help dl:last-child {
width: 90px;
text-align: center;
}
.mod_help dl dt {
padding-bottom: 10px;
font-size: 16px;
}
.mod_copyright {
margin-top: 20px;
text-align: center;
}
.links {
margin-bottom: 15px;
}
.links a {
margin: 0 3px;
}
.copyright {
line-height: 20px;
}
2.6main主体模块
以前书写的就是模块化中的公共部分。
main 主体模块是 index 里面专用的,注意需要新的样式文件 index.css。

2.6.1newsflash快报模块

newsflash中的news模块细分

===main主体模块代码展示===
效果:

整体:

index.html
<!-- 首页专有的模块main模块start -->
<div class="w">
<div class="main">
<div class="focus">
<ul>
<li><img src="../shoping/upload/focus1.png" alt=""></li>
</ul>
</div>
<div class="newsflash">
<div class="news">
<div class="news-hd">品优购快报 <a href="#">更多</a></div>
<div class="news-bd">
<ul>
<li>
<a href="#"><span>【特惠】</span> 备战开学季 全民半价购数码</a>
</li>
<li>
<a href="#"><span>【特惠】</span> 备战开学季 全民半价购数码</a>
</li>
<li>
<a href="#"><span>【特惠】</span> 备战开学季 全民半价购数码</a>
</li>
<li>
<a href="#"><span>【特惠】</span> 备战开学季 全民半价购数码</a>
</li>
<li>
<a href="#"><span>【特惠】</span> 备战开学季 全民半价购数码</a>
</li>
</ul>
</div>
</div>
<div class="lifeservice">
<ul>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
<li>
<i></i>
<p>话费</p>
</li>
</ul>
</div>
<div class="bargain">
<img src="../shoping/images/图层178.png" alt="">
</div>
</div>
</div>
</div>
<!-- 首页专有的模块main模块end -->
index.css
/* 声明字体图标 这里一定要注意路径的变化 */
@font-face {
font-family: 'icomoon';
src: url('../fonts/icomoon.eot?xdbjv3');
src: url('../fonts/icomoon.eot?xdbjv3#iefix') format('embedded-opentype'), url('../fonts/icomoon.ttf?xdbjv3') format('truetype'), url('../fonts/icomoon.woff?xdbjv3') format('woff'), url('../fonts/icomoon.svg?xdbjv3#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
/* main模块制作 */
.main {
margin: 10px 0 10px 220px;
width: 980px;
height: 455px;
}
.focus {
float: left;
}
.newsflash {
float: left;
margin-left: 8px;
width: 250px;
height: 100%;
}
.news {
height: 165px;
border: 1px solid #e4e4e4;
}
.newsflash .news-hd {
width: 100%;
height: 32px;
line-height: 32px;
padding-left: 15px;
font-size: 14px;
font-weight: 400;
border-bottom: 1px solid #e4e4e4;
}
.newsflash .news-hd a::after {
content: '\e900';
font-family: 'icomoon';
}
.news-bd ul li {
padding-left: 10px;
height: 26px;
line-height: 26px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.lifeservice {
overflow: hidden;
height: 209px;
border: 1px solid #e4e4e4;
border-top: 0;
}
.lifeservice ul {
width: 252px;
}
.lifeservice ul li {
float: left;
width: 63px;
height: 71px;
text-align: center;
border-bottom: 1px solid #e4e4e4;
border-right: 1px solid #e4e4e4;
}
.lifeservice ul li i {
display: block;
margin-left: 19px;
margin-top: 10px;
width: 23px;
height: 27px;
background-image: url(../images/精灵图.png);
background-position: -17px -17px;
}
.bargain {
margin-top: 5px;
}
2.7推荐模块制作

===推荐模块代码展示===
index.html
<!-- 推荐模块start -->
<div class="recom w">
<div class="recom-hd"><img src="../shoping/images/今日推荐.png" alt=""></div>
<div class="recom-bd">
<ul>
<li><img src="../shoping/upload/shangpin2.png" alt=""></li>
<li><img src="../shoping/upload/shangpin2.png" alt=""></li>
<li><img src="../shoping/upload/shangpin2.png" alt=""></li>
<li><img src="../shoping/upload/shangpin2.png" alt=""></li>
</ul>
</div>
</div>
<!-- 推荐模块end -->
index.css
/* 推荐模块 */
.recom {
height: 163px;
background-color: #ebebeb;
}
.recom-hd {
width: 205px;
height: 163px;
background-color: #5c5251;
float: left;
}
.recom-hd img {
margin-top: 31px;
margin-left: 66px;
}
.recom-bd {
float: left;
}
.recom-bd ul li {
position: relative;
float: left;
}
.recom-bd ul li img {
width: 248px;
height: 163px;
}
.recom-bd ul li:nth-child(-n+3)::after {
content: '';
position: absolute;
top: 10px;
right: 0;
width: 1px;
height: 145px;
background-color: #ddd;
}
2.8楼层区floor模块制作

2.8.1头部box_hd制作

2.8.2Tab栏原理-布局需求

当用户点击tab_list上的某个选项时,tab_content呈现对应内容,其他内容隐藏。
===floor模块代码展示===
index.html
<!-- 楼层floor模块start -->
<div class="floor">
<div class="w jiadian">
<div class="box-hd">
<h3>手机通讯</h3>
<div class="tab_list">
<ul>
<li><a href="#">品质优选</a></li>
<li></li>
<li><a href="#">新机尝鲜</a></li>
<li></li>
<li><a href="#">高性价比</a></li>
<li></li>
<li><a href="#">手机配件</a></li>
<li></li>
<li><a href="#">口碑推荐</a></li>
<li></li>
<li><a href="#">合约机</a></li>
<li></li>
<li><a href="#">手机卡</a></li>
<li></li>
<li><a href="#">店铺精选</a></li>
<li></li>
<li><a href="#" class="style_red">热门</a></li>
</ul>
</div>
</div>
<div class="box-bd">
<div class="tab_content">
<div class="tab_list_item">
<div class="col_210">
<ul>
<li><a href="#">节能补贴</a></li>
<li><a href="#">4k电视</a></li>
<li><a href="#">空气净化器</a></li>
<li><a href="#">IH电饭煲</a></li>
<li><a href="#">滚筒洗衣机</a></li>
<li><a href="#">电热水器</a></li>
</ul>
<a href="#"><img src="../shoping/upload/三星曲面电视抽奖送豪礼.png" alt=""></a>
</div>
<div class="col_329">
<a href="#">
<h3>烧水壶智能光控泡茶壶茶具套装</h3>
<h5> 满299.00减40.00</h5>
</a>
<a href="#"><img src="../shoping/upload/图层118拷贝.png" alt=""></a>
<div class="yuandian">
<div class="firstdot"></div>
<div></div>
<div></div>
</div>
</div>
<div class="col_221 bb">
<a href="#" class="bb"><img src="../shoping/upload/floor-1-2.png" alt=""></a>
<a href="#"><img src="../shoping/upload/floor-1-3.png" alt=""></a>
</div>
<div class="col_221">
<a href="#"><img src="../shoping/upload/floor-1-4.png" alt=""></a>
</div>
<div class="col_219">
<a href="#" class="bb"><img src="../shoping/upload/floor-1-5.png" alt=""></a>
<a href="#"><img src="../shoping/upload/floor-1-6.png" alt=""></a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 楼层floor模块end -->
index.css
/* floor楼层模块 */
.box-hd {
margin-top: 20px;
height: 35px;
line-height: 35px;
border-bottom: 2px solid #c81623;
}
.box-hd h3 {
float: left;
font-size: 18px;
font-weight: normal;
color: #c81623;
}
.tab_list {
float: right;
}
.tab_list ul li {
float: right;
}
.tab_list ul li:nth-child(even) {
width: 1px;
height: 20px;
margin: 7px 15px 0;
background-color: #999;
}
.box-bd {
height: 361px;
}
.tab_list_item>div {
height: 361px;
float: left;
}
.col_210 {
width: 210px;
background-color: #f9f9f9;
}
.col_210 ul li {
float: left;
margin-left: 14px;
width: 85px;
height: 33px;
line-height: 33px;
text-align: center;
border-bottom: 1px solid #ededed;
}
.col_210 img {
margin-top: 25px;
margin-left: 28px;
}
.col_329 {
width: 329px;
background-color: #aed6d8;
}
.col_329 a h3 {
margin-top: 40px;
margin-left: 30px;
color: #1d7584;
font-size: 18px;
}
.col_329 a h5 {
margin-left: 30px;
color: #1d7584;
font-size: 16px;
}
.col_329 a img {
margin-top: 30px;
margin-left: 55px;
}
.yuandian {
margin-left: 137px;
}
.yuandian div {
float: left;
margin-left: 7px;
width: 10px;
height: 10px;
background-color: #3e3e3e;
border-radius: 5px;
}
.yuandian .firstdot {
background-color: #fff;
}
.col_221 {
width: 221px;
border-right: 1px solid #ccc;
}
.col_219 {
width: 219px;
}
.bb {
display: block;
border-bottom: 1px solid #ccc;
}

===主页完成展示===
3.品优购列表页制作
3.1准备工作
3.2列表页header和nav修改
===header和nav修改代码展示===
list.html
<!-- 秒杀模块 -->
<div class="sk">
<img src="../shoping/upload/sk.png" alt="">
</div>
<!-- nav导航部分start -->
<nav class="nav">
<div class="w">
<div class="sk_list">
<ul>
<li><a href="#">品优秒杀</a></li>
<li><a href="#">即将售罄</a></li>
<li><a href="#">超值低价</a></li>
</ul>
</div>
<div class="sk_con">
<ul>
<li><a href="#">女装</a></li>
<li><a href="#" class="style_red">女鞋</a></li>
<li><a href="#">男装</a></li>
<li><a href="#">男鞋</a></li>
<li><a href="#">母婴童装</a></li>
<li><a href="#">食品</a></li>
<li><a href="#">智能数码</a></li>
<li><a href="#">运动户外</a></li>
<li><a href="#">更多分类</a></li>
</ul>
</div>
</div>
</nav>
<!-- nav导航部分end -->
list.css
.zhongjian {
width: 1200px;
height: 600px;
}
.sk {
position: absolute;
top: 40px;
left: 183px;
padding: 3px 0 3px 14px;
border-left: 2px solid #b1191a;
}
.sk_list {
float: left;
height: 47px;
}
.sk_list ul li {
float: left;
padding: 0 30px;
font-size: 16px;
font-weight: 700;
}
.sk_list ul li a {
color: black;
}
.sk_con {
float: left;
}
.sk_con ul li {
float: left;
margin-left: 50px;
height: 47px;
line-height: 49px;
}
.sk_con ul li:last-child::after {
content: '\e901';
font-family: 'icomoon';
}
3.3列表页主体 sk_con tainer

===列表页主体代码展示===
list.html
<!-- 主体模块start -->
<div class="sk_container w">
<div class="sk_hd"><img src="../shoping/images/正在抢购.png" alt=""></div>
<div class="sk_bd">
<ul class="clearfix">
<li>
<div>
<!-- 图片板块 -->
<img src="../shoping/upload/华为mate40.jpg" alt="">
<!-- 标题板块 -->
<p>mate40Pro无充电器版【TWS无线耳机套装】5G手机</p>
<!-- 价格板块 -->
<div class="price">
<span class="miaosha">¥7478</span>
<span class="origin">¥7499</span>
</div>
<!-- 输出情况板块 -->
<div class="situation">
<div class="sold">已售<span>87%</span></div>
<div class="progress">
<span></span>
</div>
<div class="have">剩余<span>29</span>件</div>
</div>
<!-- 抢购板块 -->
<a href="#">立即抢购</a>
</div>
</li>
<li>
<div>
<!-- 图片板块 -->
<img src="../shoping/upload/华为mate40.jpg" alt="">
<!-- 标题板块 -->
<p>mate40Pro无充电器版【TWS无线耳机套装】5G手机</p>
<!-- 价格板块 -->
<div class="price">
<span class="miaosha">¥7478</span>
<span class="origin">¥7499</span>
</div>
<!-- 输出情况板块 -->
<div class="situation">
<div class="sold">已售<span>87%</span></div>
<div class="progress">
<span></span>
</div>
<div class="have">剩余<span>29</span>件</div>
</div>
<!-- 抢购板块 -->
<a href="#">立即抢购</a>
</div>
</li>
<li>
<div>
<!-- 图片板块 -->
<img src="../shoping/upload/华为mate40.jpg" alt="">
<!-- 标题板块 -->
<p>mate40Pro无充电器版【TWS无线耳机套装】5G手机</p>
<!-- 价格板块 -->
<div class="price">
<span class="miaosha">¥7478</span>
<span class="origin">¥7499</span>
</div>
<!-- 输出情况板块 -->
<div class="situation">
<div class="sold">已售<span>87%</span></div>
<div class="progress">
<span></span>
</div>
<div class="have">剩余<span>29</span>件</div>
</div>
<!-- 抢购板块 -->
<a href="#">立即抢购</a>
</div>
</li>
<li>
<div>
<!-- 图片板块 -->
<img src="../shoping/upload/华为mate40.jpg" alt="">
<!-- 标题板块 -->
<p>mate40Pro无充电器版【TWS无线耳机套装】5G手机</p>
<!-- 价格板块 -->
<div class="price">
<span class="miaosha">¥7478</span>
<span class="origin">¥7499</span>
</div>
<!-- 输出情况板块 -->
<div class="situation">
<div class="sold">已售<span>87%</span></div>
<div class="progress">
<span></span>
</div>
<div class="have">剩余<span>29</span>件</div>
</div>
<!-- 抢购板块 -->
<a href="#">立即抢购</a>
</div>
</li>
<li>
<div>
<!-- 图片板块 -->
<img src="../shoping/upload/华为mate40.jpg" alt="">
<!-- 标题板块 -->
<p>mate40Pro无充电器版【TWS无线耳机套装】5G手机</p>
<!-- 价格板块 -->
<div class="price">
<span class="miaosha">¥7478</span>
<span class="origin">¥7499</span>
</div>
<!-- 输出情况板块 -->
<div class="situation">
<div class="sold">已售<span>87%</span></div>
<div class="progress">
<span></span>
</div>
<div class="have">剩余<span>29</span>件</div>
</div>
<!-- 抢购板块 -->
<a href="#">立即抢购</a>
</div>
</li>
<li>
<div>
<!-- 图片板块 -->
<img src="../shoping/upload/华为mate40.jpg" alt="">
<!-- 标题板块 -->
<p>mate40Pro无充电器版【TWS无线耳机套装】5G手机</p>
<!-- 价格板块 -->
<div class="price">
<span class="miaosha">¥7478</span>
<span class="origin">¥7499</span>
</div>
<!-- 输出情况板块 -->
<div class="situation">
<div class="sold">已售<span>87%</span></div>
<div class="progress">
<span></span>
</div>
<div class="have">剩余<span>29</span>件</div>
</div>
<!-- 抢购板块 -->
<a href="#">立即抢购</a>
</div>
</li>
<li>
<div>
<!-- 图片板块 -->
<img src="../shoping/upload/华为mate40.jpg" alt="">
<!-- 标题板块 -->
<p>mate40Pro无充电器版【TWS无线耳机套装】5G手机</p>
<!-- 价格板块 -->
<div class="price">
<span class="miaosha">¥7478</span>
<span class="origin">¥7499</span>
</div>
<!-- 输出情况板块 -->
<div class="situation">
<div class="sold">已售<span>87%</span></div>
<div class="progress">
<span></span>
</div>
<div class="have">剩余<span>29</span>件</div>
</div>
<!-- 抢购板块 -->
<a href="#">立即抢购</a>
</div>
</li>
<li>
<div>
<!-- 图片板块 -->
<img src="../shoping/upload/华为mate40.jpg" alt="">
<!-- 标题板块 -->
<p>mate40Pro无充电器版【TWS无线耳机套装】5G手机</p>
<!-- 价格板块 -->
<div class="price">
<span class="miaosha">¥7478</span>
<span class="origin">¥7499</span>
</div>
<!-- 输出情况板块 -->
<div class="situation">
<div class="sold">已售<span>87%</span></div>
<div class="progress">
<span></span>
</div>
<div class="have">剩余<span>29</span>件</div>
</div>
<!-- 抢购板块 -->
<a href="#">立即抢购</a>
</div>
</li>
</ul>
</div>
</div>
<!-- 主体模块end -->
list.css
/* 主体模块 */
.sk_hd {
height: 120px;
}
.sk_bd {
width: 1220px;
margin-top: 25px;
}
.sk_bd ul li {
float: left;
margin-right: 15px;
margin-bottom: 15px;
width: 290px;
height: 460px;
}
.sk_bd ul li:hover {
border: 1px solid #e12228;
}
.sk_bd ul li div img {
display: block;
margin: 10px auto;
height: 200px;
}
.sk_bd ul li div p {
display: block;
margin-top: 30px;
padding: 0 10px;
font-size: 17px;
color: gray;
}
.price {
margin-top: 5px;
margin-left: 5px;
}
.price .miaosha {
font-weight: 700;
font-size: 26px;
color: #e43736;
}
.price .origin {
color: gray;
font-weight: 700;
text-decoration: line-through;
}
.situation {
margin-top: 15px;
width: 100%;
height: 27px;
}
.sold,
.have {
float: left;
padding-left: 10px;
font-size: 15px;
line-height: 27px;
}
.sold span,
.have span {
color: #e96256;
}
.progress {
float: left;
width: 130px;
height: 15px;
margin-top: 7px;
margin-left: 10px;
border: 1px solid red;
border-radius: 10px;
}
.progress span {
float: left;
width: 100px;
height: 100%;
background-color: red;
border: 1px solid red;
border-radius: 10px 0 0 10px;
}
.sk_bd ul li div a {
display: block;
margin-top: 21px;
width: 100%;
height: 60px;
background-color: #bd2716;
color: white;
text-decoration: none;
line-height: 60px;
text-align: center;
font-size: 25px;
}
效果:

4.品优购注册页制作
4.1注册页类名命名
注册页面:register.html
注意:注册页面比较隐私,我们不需要对当前页面进行SEO优化

===注册页面代码展示===
register.html
<div class="w">
<header class="header">
<div class="logo">
<a href="index.html">
<img src="../shoping/images/pinyou.com.png" alt="">
</a>
</div>
</header>
<div class="registerarea">
<h3>注册新用户
<div class="log_in">我有账号,去<a href="#" class="style_red">登录</a></div>
</h3>
<div class="reg-form">
<ul>
<li>
<label for="">手机号:</label>
<input type="text" name="" id="" class="inp">
<span class="error">
<i class="error_icon">
</i>手机号码格式不正确,请从新输入
</span>
</li>
<li>
<label for="">短信验证码:</label>
<input type="text" name="" id="" class="inp">
<span class="success">
<i class="success_icon">
</i>短信验证码输入正确
</span>
</li>
<li>
<label for="">登陆密码:</label>
<input type="text" name="" id="" class="inp">
<span class="error">
<i class="error_icon">
</i>手机号码格式不正确,请从新输入
</span>
</li>
<li class="safe">安全程度:<em class="ruo">弱</em> <em class="zhong">中</em> <em class="qiang">强</em></li>
<li>
<label for="">确认密码:</label>
<input type="text" name="" id="" class="inp">
<span class="error">
<i class="error_icon">
</i>手机号码格式不正确,请从新输入
</span>
</li>
<li class="agree"><input type="checkbox">同意协议并注册<a href="#">《知果果用户协议》</a></li>
<li><button class="btn">完成注册</button></li>
</ul>
</div>
</div>
<footer class="footer">
<!-- 版权模块 -->
<div class="mod_copyright">
<div class="links"> <a href="">关于我们</a> | <a href="#">联系我们</a> | <a href="#">联系客服</a> | <a href="#">商家入驻</a> | <a href="#">营销中心</a> | <a href="#">手机品优购</a> | <a href="#">友情链接</a> | <a href="#">销售联盟</a> | <a href="#">品优购社区</a> | <a href="#">品优购公益</a> |
<a href="#">English Site</a> | <a href="#">Contact U</a></div>
<div class="copyright">地址:北京市昌平区建材城西路金燕龙办公楼一层 邮编:100096 电话:400-618-4000 传真:010-82935100 邮箱: zhanghj+itcast.cn<br> 京ICP备08001421号京公网安备110108007702
</div>
</div>
</footer>
</div>
register.css
.w {
width: 1200px;
margin: 0 auto;
}
.header {
height: 85px;
border-bottom: 2px solid #b1191a;
}
.header img {
margin-left: -15px;
padding-top: 10px;
}
.registerarea {
margin-top: 20px;
height: 525px;
border: 1px solid #ccc;
}
.registerarea h3 {
padding: 0 10px;
height: 42px;
color: #333;
line-height: 42px;
font-size: 18px;
font-weight: 400;
padding-left: 10px;
background-color: #ececec;
border-bottom: 1px solid #ccc;
}
.registerarea .log_in {
float: right;
font-size: 14px;
}
.log_in {
margin-right: 10px;
}
.log_in a {
color: #cd474e;
}
.reg-form {
width: 600px;
margin: 50px auto 0;
}
.reg-form label {
display: inline-block;
width: 88px;
text-align: right;
}
.reg-form ul li input {
width: 242px;
height: 37px;
border: 1px solid #ccc
}
.error {
color: #df3033;
}
.error_icon,
.success_icon {
display: inline-block;
margin-top: -2px;
vertical-align: middle;
width: 20px;
height: 20px;
background: url(../images/error.png) no-repeat;
}
.success {
color: green;
}
.success_icon {
background: url(../images/success.png) no-repeat;
}
.reg-form ul li {
margin-bottom: 20px;
}
.safe {
padding-left: 158px;
}
.safe em {
padding: 0 12px;
}
.ruo {
background-color: #de1111;
}
.zhong {
background-color: #40b83f;
}
.qiang {
background-color: #f79100;
}
.agree {
padding: 35px 0 35px 100px;
}
.agree input[type=checkbox] {
margin-right: 5px;
width: 15px;
height: 15px;
}
.agree a {
padding-left: 10px;
color: #1ba1e6;
}
.btn {
margin-left: 110px;
width: 200px;
height: 35px;
color: #fff;
font-size: 14px;
line-height: 35px;
text-align: center;
background-color: #c81623;
}
.mod_copyright {
margin-top: 20px;
text-align: center;
}
.links {
margin-bottom: 15px;
}
.links a {
margin: 0 3px;
}
.copyright {
line-height: 20px;
}
效果:

5.Web服务器
5.1什么是Web服务器


5.2本地服务器
我们可以把自己的电脑设置为本地服务器,这样同一个区域网内的同学就可以访问你的品优购网站了。后面学ajax'的时候,在进行讲解。
5.3远程服务器

5.4将自己的网站上传到远程服务器
注意:一般稳定的服务器都是要收费的。比如:阿里云
推荐:GitHub免费 wwwwwwwwww

388

被折叠的 条评论
为什么被折叠?



