1.思考
(1). 开发工具sublime 、fireworks(ps)、各种浏览器(ie6.7 要测看心情)
(2). CSS Rest 类库(CSS初始化类库),为跨浏览器兼容做准备(也可以直接运用jd网站的初始化)
normalize.css 只是一个很小的CSS文件,但它在默认的HTML元素样式上提供了跨浏览器的高度一致性。
相比于传统的CSS reset,Normalize.css是一种现代的、为HTML5准备的优质替代方案。
Normalize.css现在已经被用于Twitter Bootstrap、HTML5 Boilerplate、GOV.UK、Rdio、CSS Tricks 以及许许多多其他框架、工具和网站上。
- 保护有用的浏览器默认样式而不是完全去掉它们
- 一般化的样式:为大部分HTML元素提供
- 修复浏览器自身的bug并保证各浏览器的一致性
- 优化CSS可用性:用一些小技巧
- 解释代码:用注释和详细的文档来
(3). 技术栈
HTML5 结构 + CSS3 布局 (因为我们就会这些。。。嘻嘻)
(4). 低版本浏览器 单独制作一个跳转页面
https://h5.m.jd.com/dev/3dm8aE4LDBNMkDfcCaRxLnVQ7rqo/index.html
2.工程目录结构
引入ico图标
<link rel="shortcut icon" href="favicon.ico"/>
注意:
-
她(它)不是iconfont字体,也不是图片,只是图标。
-
位置是放到 head 标签中间。
-
为了兼容性,请将favicon.ico 这个图标放到根目录下。
-
推荐一个制作ico图标的网站:http://www.bitbug.net/
效果:
3.代码案例
链入外部文件:
<!-- 工程图标 -->
<link rel="shortcut icon" href="favicon.ico"/>
<!-- normalize css初始化类库,针对浏览器 -->
<link ref="stylesheet" href="css/normalize.css" />
<!-- base 里面只写公共样式 针对JD网页 -->
<link rel="stylesheet" href="css/base.css" />
<!-- JD首页CSS -->
<link rel="stylesheet" href="css/index.css" />
JD主页
先确定版心
-
任务一:完成JD主页顶部
index.html
<!-- 京东顶部开始 -->
<div class="J_event">
<a href="#" class="w">
<i></i>
</a>
</div>
<!-- 京东顶部结束 -->
base.css
* {
margin: 0px;
}
/* 版心 */
.w {
width: 1190px;
margin: auto;
}
.fr {
float: right;
}
.fl {
float: left;
}
/* 字体图标 */
@font-face {
font-family: 'iconfont';
src: url('../fonts/iconfont.eot');
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/iconfont.woff2') format('woff2'),
url('../fonts/iconfont.woff') format('woff'),
url('../fonts/iconfont.ttf') format('truetype'),
url('../fonts/iconfont.svg#iconfont') format('svg');
}
/* 京东 顶部start */
.J_event {
height: 80px;
background-color: #000;
}
.J_event a {
display: block;
height: 80px;
position: relative;
background: url(../images/top.jpg) no-repeat;
}
.J_event a i {
width: 20px;
height: 20px;
position: absolute;
right: 0;
top: 5px;
font-family: "iconfont" !important;
font-style: normal;
text-align: center;
line-height: 20px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #fff;
background-color: rgba(255,255,255,0.3);
}
/* 京东 顶部样式 */
-
任务二:完成JD主页导航栏
index.html
<!-- 快捷导航栏模块开始 -->
<div class="shortcut">
<div class="w">
<ul class="fl">
<li><i></i>北京</li>
</ul>
<ul class="fr">
<li>
<a href="#">
你好,请登录
</a>
<a href="#" class="style-red">
免费注册
</a>
</li>
<li class="spacer"></li>
<li>
<a href="#">
我的订单
</a>
</li>
<li class="spacer"></li>
<li class="dropdown">
<a href="#">
我的京东
</a>
<i></i>
</li>
<li class="spacer"></li>
<li>
<a href="#">
京东会员
</a>
</li>
<li class="spacer"></li>
<li>
<a href="#">
企业采购
</a>
</li>
<li class="spacer"></li>
<li class="dropdown">
<a href="#">
客户服务
</a>
<i></i>
</li>
<li class="spacer"></li>
<li class="dropdown">
<a href="#">
网站导航
</a>
<i></i>
</li>
<li class="spacer"></li>
<li style="position: relative; z-index: 1;">
<a href="#">
手机京东
</a>
<div class="erweima">
<img src="images/erweima.png" alt="">
</div>
</li>
</ul>
</div>
</div>
<!-- 快捷导航栏模块结束 -->
base.css
* {
margin: 0px;
}
/* 版心 */
.w {
width: 1190px;
margin: auto;
}
.fr {
float: right;
}
.fl {
float: left;
}
li {
list-style: none;
}
ul {
margin: 0px;
padding: 0px;
}
a {
text-decoration: none;
}
/* 字体图标 */
@font-face {
font-family: 'iconfont';
src: url('../fonts/iconfont.eot');
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/iconfont.woff2') format('woff2'),
url('../fonts/iconfont.woff') format('woff'),
url('../fonts/iconfont.ttf') format('truetype'),
url('../fonts/iconfont.svg#iconfont') format('svg');
}
/* 京东 顶部start */
.J_event {
height: 80px;
background-color: #000;
}
.J_event a {
display: block;
height: 80px;
position: relative;
background: url(../images/top.jpg) no-repeat;
}
.J_event a i {
width: 20px;
height: 20px;
position: absolute;
right: 0;
top: 5px;
font-family: "iconfont" !important;
font-style: normal;
text-align: center;
line-height: 20px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #fff;
background-color: rgba(255,255,255,0.3);
}
/* 京东 顶部样式 */
/*京东导航栏开始*/
.shortcut {
height: 30px;
line-height: 30px;
background-color: #E3E4E5;
border-bottom: 1px solid #DDDDDD;
color: #9D9D9D;
font-size: 12px;
}
.w .fl li i{
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: red;
font-size: 22px;
}
.shortcut a {
color: #9D9D9D;
font-size: 12px;
text-decoration: none;
}
.shortcut a:hover {
color: #c81623;
}
.shortcut .fr li {
float: left;
}
.spacer {
width: 1px;
height: 10px;
background-color: #ccc;
margin: 10px 10px 0;
}
.dropdown i {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: middle;
}
/*京东导航栏结束*/
-
任务三:完成header头部
index.html
<!-- header 部分 start -->
<div class="header">
<div class="w inner">
<!-- logo 部分 -->
<div class="logo">
<h1>
<a href="#" title="京东网">京东</a>
</h1>
</div>
<!-- 搜索部分 -->
<div class="search">
<input type="text" value="单反相机">
<button>
<i></i>
</button>
<em></em>
</div>
<!-- 热词部分 -->
<div class="hotwords">
<a href="#" class="style-red">学生专享</a>
<a href="#">300减160</a>
<a href="#">七折返场</a>
<a href="#">骑行运动</a>
<a href="#">家电榜单</a>
<a href="#">无损播放器</a>
<a href="#">汽车脚垫</a>
<a href="#">巧克力</a>
<a href="#">铝合金门窗</a>
</div>
<!-- 购物车 -->
<div class="myCar">
<i></i>
<a href="#">我的购物车</a>
<s>0</s>
</div>
<!-- 电脑 -->
<div class="computer">
<a href="#">
<img src="images/computer.jpg" height="40" width="190" alt="">
</a>
</div>
</div>
</div>
<!-- header 部分 end-->
* {
margin: 0px;
}
/* 版心 */
.w {
width: 1190px;
margin: auto;
}
.fr {
float: right;
}
.fl {
float: left;
}
li {
list-style: none;
}
ul {
margin: 0px;
padding: 0px;
}
a {
text-decoration: none;
}
/* 字体图标 */
@font-face {
font-family: 'iconfont';
src: url('../fonts/iconfont.eot');
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/iconfont.woff2') format('woff2'),
url('../fonts/iconfont.woff') format('woff'),
url('../fonts/iconfont.ttf') format('truetype'),
url('../fonts/iconfont.svg#iconfont') format('svg');
}
/* 京东 顶部start */
.J_event {
height: 80px;
background-color: #000;
}
.J_event a {
display: block;
height: 80px;
position: relative;
background: url(../images/top.jpg) no-repeat;
}
.J_event a i {
width: 20px;
height: 20px;
position: absolute;
right: 0;
top: 5px;
font-family: "iconfont" !important;
font-style: normal;
text-align: center;
line-height: 20px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #fff;
background-color: rgba(255,255,255,0.3);
}
/* 京东 顶部样式 */
/*京东导航栏开始*/
.shortcut {
height: 30px;
line-height: 30px;
background-color: #E3E4E5;
border-bottom: 1px solid #DDDDDD;
color: #9D9D9D;
font-size: 12px;
}
.w .fl li i{
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: red;
font-size: 22px;
margin-left: 200px;
}
.shortcut a {
color: #9D9D9D;
font-size: 12px;
text-decoration: none;
}
.shortcut a:hover {
color: #c81623;
}
.shortcut .fr li {
float: left;
}
.spacer {
width: 1px;
height: 10px;
background-color: #ccc;
margin: 10px 10px 0;
}
.dropdown i {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: middle;
}
/*京东导航栏结束*/
/* header 部分 start */
.header {
height: 140px;
}
.inner {
height: 140px;
background-color: pink;
position: relative;
}
/* header 部分 end */
.logo {
width: 190px;
height: 170px;
position: absolute;
top: -30px;
left: 0;
background-color: purple;
box-shadow: 0 -12px 10px rgba(0,0,0,.2);
}
.logo h1 {
margin: 0;
}
.logo a {
display: block;
width: 190px;
height: 170px;
background: url(../images/logo.jpg) no-repeat;
text-indent: -99999px;
overflow: hidden;
}
.search {
width: 550px;
height: 35px;
position: absolute;
top: 25px;
left: 320px;
}
.search input {
width: 493px;
height: 33px;
border: 1px solid #F10215;
padding-left: 5px;
outline: none; /* 取消蓝色边框 */
color: #989898;
float: left;
}
.search button {
width: 50px;
height: 39px;
background-color: #F10215;
float: left;
cursor: pointer; /* 鼠标变成小手 */
outline: none;
vertical-align: middle;
}
.search i {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: white;
}
.search em {
position: absolute;
top: 10px;
right: 65px;
width: 19px;
height: 15px;
cursor: pointer;
background: url(../images/sprite-search.png) no-repeat;
}
.search em:hover {
background-position: -30px 0;
}
.hotwords {
position: absolute;
top: 70px;
left: 320px;
}
.hotwords a {
color: #9E9B99;
font-size: 12px;
}
.hotwords a:hover {
color: #f10215;
}
.myCar {
width: 188px;
height: 33px;
border: 1px solid #ccc;
position: absolute;
top: 25px;
right: 100px;
text-align: center;
line-height: 33px;
}
.myCar a {
font-size: 12px;
color: #f10215;
}
.myCar i {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: red;
}
.myCar s {
position: absolute;
top: 5px;
left: 140px;
text-decoration: none;
background-color: #f10215;
height: 16px;
line-height: 16px;
font-size: 12px;
padding: 0 3px;
border-radius: 7px;
color: #fff;
}
.computer {
position: absolute;
right: 0;
bottom: 10px;
}
-
任务四:完成main内容
index.html
<!-- main 部分开始 -->
<div class="jd">
<div class="w jd-inner">
<div class="jd-clo1">
<ul>
<li><a href="#">家用电器</a></li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">电脑</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
<li>
<a href="#">手机</a>
<span>/</span>
<a href="#">运营商</a>
<span>/</span>
<a href="#">数码</a>
</li>
</ul>
</div>
<div class="jd-clo2">
<div class="jd-clo2-hd">
<a href="#" class="arr-l"></a>
<a href="#" class="arr-r"></a>
<ol>
<li class="current"></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ol>
<ul>
<li><a href="#"><img src="images/banner.jpg"></a></li>
</ul>
</div>
<div class="jd-clo2-bd">
<div class="firstPic">
<img src="images/pic1.jpg" >
</div>
<div>
<img src="images/pic2.jpg" >
</div>
</div>
</div>
<div class="jd-clo3"></div>
</div>
<!-- 广告结束 -->
<div class="ad">
<a href="#"></a>
</div>
</div>
<!-- main 部分end -->
index.css
/* 首页的CSS */
.jd {
/* height: 480px; */
background-color: pink;
position: relative;
}
.jd-inner {
height: 480px;
background-color: skyblue;
z-index: 999; /* 只有定位的盒子才有 z-index */
position: relative;
}
.ad {
height: 480px;
background: url(../images/bg.png) no-repeat top center;
position: absolute; /* 行内块转换 */
top: 0;
left: 0;
width: 100%; /* 强制显示宽度 */
}
.ad a {
display: block;
height: 100%;
}
.jd-clo1 {
width: 190px;
height: 465px;
background-color: #6E6568;
float: left;
padding-top: 15px;
}
.jd-clo1 li {
padding-left: 10px;
height: 28px;
line-height: 28px;
}
.jd-clo1 li:hover {
background-color: #999395;
}
.jd-clo1 li a {
color: #fff;
font-size: 14px;
}
.jd-clo1 li span {
color: #fff;
font-size: 12px;
}
.jd-clo2 {
width: 790px;
height: 480px;
float: left;
margin-left: 10px;
}
.jd-clo2-hd {
height: 340px;
margin-bottom: 10px;
position: relative;
}
.jd-clo2-bd div {
width: 390px;
height: 130px;
float: left;
}
.jd-clo2-bd div img {
width: 100%;
}
.firstPic {
margin-right: 10px;
}
.arr-l, .arr-r {
position: absolute;
top: 50%;
margin-top: -30px;
width: 30px;
height: 60px;
background: rgba(0, 0, 0, 0.3);
font-family: "icomoon";
color: #fff;
text-align: center;
line-height: 60px;
font-size: 25px;
}
.arr-l {
left: 0;
}
.arr-r {
right: 0;
}
.jd-clo2-hd ol {
position: absolute;
bottom: 20px;
left: 50%;
margin-left: -90px;
width: 180px;
height: 20px;
background: rgba(255, 255,255, 0.3);
border-radius: 10px;
}
.jd-clo2-hd ol li {
width: 12px;
height: 12px;
background-color: #fff;
border-radius: 50%;
float: left;
margin: 4px 5px;
cursor: pointer;
}
.jd-clo2-hd .current {
background-color: #f10215;
}
.jd-clo3 {
width: 190px;
height: 480px;
background-color: yellow;
float: right;
}
base.css
* {
margin: 0px;
}
/* 版心 */
.w {
width: 1190px;
margin: auto;
}
.fr {
float: right;
}
.fl {
float: left;
}
li {
list-style: none;
}
ul {
margin: 0px;
padding: 0px;
}
a {
text-decoration: none;
}
/* 字体图标 */
@font-face {
font-family: 'iconfont';
src: url('../fonts/iconfont.eot');
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/iconfont.woff2') format('woff2'),
url('../fonts/iconfont.woff') format('woff'),
url('../fonts/iconfont.ttf') format('truetype'),
url('../fonts/iconfont.svg#iconfont') format('svg');
}
/* 京东 顶部start */
.J_event {
height: 80px;
background-color: #000;
}
.J_event a {
display: block;
height: 80px;
position: relative;
background: url(../images/top.jpg) no-repeat;
}
.J_event a i {
width: 20px;
height: 20px;
position: absolute;
right: 0;
top: 5px;
font-family: "iconfont" !important;
font-style: normal;
text-align: center;
line-height: 20px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #fff;
background-color: rgba(255,255,255,0.3);
}
/* 京东 顶部样式 */
/*京东导航栏开始*/
.shortcut {
height: 30px;
line-height: 30px;
background-color: #E3E4E5;
border-bottom: 1px solid #DDDDDD;
color: #9D9D9D;
font-size: 12px;
}
.w .fl li i{
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: red;
font-size: 22px;
margin-left: 200px;
}
.shortcut a {
color: #9D9D9D;
font-size: 12px;
text-decoration: none;
}
.shortcut a:hover {
color: #c81623;
}
.shortcut .fr li {
float: left;
}
.spacer {
width: 1px;
height: 10px;
background-color: #ccc;
margin: 10px 10px 0;
}
.dropdown i {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: middle;
}
/*京东导航栏结束*/
/* header 部分 start */
.header {
height: 140px;
}
.inner {
height: 140px;
background-color: pink;
position: relative;
}
/* header 部分 end */
.logo {
width: 190px;
height: 170px;
position: absolute;
top: -30px;
left: 0;
background-color: purple;
box-shadow: 0 -12px 10px rgba(0,0,0,.2);
}
.logo h1 {
margin: 0;
}
.logo a {
display: block;
width: 190px;
height: 170px;
background: url(../images/logo.jpg) no-repeat;
text-indent: -99999px;
overflow: hidden;
}
.search {
width: 550px;
height: 35px;
position: absolute;
top: 25px;
left: 320px;
}
.search input {
width: 493px;
height: 33px;
border: 1px solid #F10215;
padding-left: 5px;
outline: none; /* 取消蓝色边框 */
color: #989898;
float: left;
}
.search button {
width: 50px;
height: 39px;
background-color: #F10215;
float: left;
cursor: pointer; /* 鼠标变成小手 */
outline: none;
vertical-align: middle;
}
.search i {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: white;
}
.search em {
position: absolute;
top: 10px;
right: 65px;
width: 19px;
height: 15px;
cursor: pointer;
background: url(../images/sprite-search.png) no-repeat;
}
.search em:hover {
background-position: -30px 0;
}
.hotwords {
position: absolute;
top: 70px;
left: 320px;
}
.hotwords a {
color: #9E9B99;
font-size: 12px;
}
.hotwords a:hover {
color: #f10215;
}
.myCar {
width: 188px;
height: 33px;
border: 1px solid #ccc;
position: absolute;
top: 25px;
right: 100px;
text-align: center;
line-height: 33px;
}
.myCar a {
font-size: 12px;
color: #f10215;
}
.myCar i {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: red;
}
.myCar s {
position: absolute;
top: 5px;
left: 140px;
text-decoration: none;
background-color: #f10215;
height: 16px;
line-height: 16px;
font-size: 12px;
padding: 0 3px;
border-radius: 7px;
color: #fff;
}
.computer {
position: absolute;
right: 0;
bottom: 10px;
}
/* 导航栏信息模块 */
.navitems {
position: absolute;
left: 200px;
bottom: 0;
}
.navitems ul {
float: left;
}
.navitems ul li{
float: left;
margin-left: 30px;
}
.navitems li a {
font-size: 16px;
color: #555A5F;
font-weight: 700;
height: 40px;
line-height: 40px;
display: block;
}
.navitems li a:hover {
color: #f10215;
}
.navitems .spacer {
float: left;
margin-top: 15px;
margin-left: 20px;
margin-right: -10px;
}
/* footer 开始啦 */
.footer {
height: 560px;
background-color: #EAEAEA;
}
.footer-service {
border-bottom: 1px solid #DEDEDE;
}
.footer-service-inner {
padding: 30px 0;
}
.footer-service-inner li {
float: left;
width: 297px;
height: 42px;
}
.service_unit {
width: 225px;
height: 42px;
margin: 0 auto;
position: relative;
}
.service_unit h5 {
width: 36px;
height: 42px;
position: absolute;
top: 0;
left: 0;
background: url(../images/ico_service.png) no-repeat;
text-indent: -999px;
overflow: hidden;
}
.service_unit p {
line-height: 42px;
margin-left: 45px;
font-size: 18px;
font-weight: 700;
}
.service_unit .kuai {
background-position: 0 -44px;
}
.service_unit .hao {
background-position: 0 -86px;
}
.service_unit .sheng {
background-position: 0 -128px;
}
.help {
height: 180px;
/* background-color: pink; */
padding-top: 20px;
}
.help dl {
float: left;
width: 195px;
}
.help dt {
font-size: 14px;
font-weight: 700;
color: #666;
height: 30px;
}
.help dd {
height: 22px;
}
.help dd a{
color: #727272;
font-size: 12px;
}
.help dd a:hover {
color: #f10215;
}
.help .cover {
float: right;
width: 207px;
height: 150px;
background: url(../images/ico_footer.png) no-repeat;
}
.cover dt {
text-align: center;
}
.help .info {
width: 175px;
height: 50px;
font-size: 12px;
margin-top: 5px;
margin-left: 10px;
line-height: 18px;
color: #727272;
}
.more {
text-align: right;
padding-right: 10px;
}
/* 版权模块 */
.copyright {
border-top: 1px solid #ccc;
padding-top: 15px;
}
.links {
text-align: center;
}
.links a {
color: #727272;
font-size: 12px;
}
.links span {
font-size: 12px;
color: #D4CDCD;
margin: 0 6px;
}
.c-info {
font-size: 12px;
color: #9E9E9B;
text-align: center;
line-height: 20px;
margin-top: 10px;
}
.tupian {
text-align: center;
margin-top: 10px;
}
.tupian a{
width: 103px;
height: 32px;
display: inline-block;
background: url(../images/ico_footer.png) no-repeat 0 -151px;
}
.tupian .kexin {
background-position: -104px -151px;
}
-
任务五:完成页脚
index.html
<!-- 页面底部分 -->
<div class="footer">
<!-- 多快好省 -->
<div class="footer-service">
<div class="w footer-service-inner">
<ul class="clearfix">
<li>
<div class="service_unit">
<h5>多</h5>
<p>品类齐全,轻松购物</p>
</div>
</li>
<li>
<div class="service_unit">
<h5 class="kuai">快</h5>
<p>多仓直发,极速配送</p>
</div>
</li>
<li>
<div class="service_unit">
<h5 class="hao">好</h5>
<p>正品行货,精致服务</p>
</div>
</li>
<li>
<div class="service_unit">
<h5 class="sheng">省</h5>
<p>天天低价,畅选无忧</p>
</div>
</li>
</ul>
</div>
</div>
<!-- 帮助模块 -->
<div class="w 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 class="cover">
<dt>京东自营覆盖区县</dt>
<dd class="info">京东已向全国2661个区县提供自营配送服务,支持货到付款、POS机刷卡和售后上门服务。
</dd>
<dd class="more"><a href="#">查看详情 > </a></dd>
</dl>
</div>
<!-- 版权模块 -->
<div class="w copyright">
<div class="links">
<a href="#">关于我们</a>
<span>|</span>
<a href="#">关于我们</a>
<span>|</span>
<a href="#">关于我们</a>
<span>|</span>
<a href="#">关于我们</a>
<span>|</span>
<a href="#">关于我们</a>
<span>|</span>
<a href="#">关于我们</a>
<span>|</span>
<a href="#">关于我们</a>
<span>|</span>
<a href="#">关于我们</a>
<span>|</span>
<a href="#">关于我们</a>
<span>|</span>
<a href="#">关于我们</a>
<span>|</span>
<a href="#">关于我们</a>
<span>|</span>
<a href="#">English</a>
<span>|</span>
<a href="#">Site</a>
<span>|</span>
<a href="#">Media & IR</a>
<span>|</span>
</div>
<div class="c-info">
<p>京公网安备 11000002000088号|京ICP证070359号|互联网药品信息服务资格证编号(京)-经营性-2014-0008|新出发京零 字第大120007号</p>
<p>互联网出版许可证编号新出网证(京)字150号|出版物经营许可证|网络文化经营许可证京网文[2014]2148-348号|违法和不良信息举报电话:4006561155</p>
<p>Copyright © 2004 - 2017 京东JD.com 版权所有|消费者维权热线:4006067733经营证照</p>
<p>京东旗下网站:京东支付|京东云</p>
</div>
<div class="tupian">
<a href="#"></a>
<a href="#" class="kexin"></a>
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
</div>
</div>
</div>
base.css
* {
margin: 0px;
}
/* 版心 */
.w {
width: 1190px;
margin: auto;
}
.fr {
float: right;
}
.fl {
float: left;
}
li {
list-style: none;
}
ul {
margin: 0px;
padding: 0px;
}
a {
text-decoration: none;
}
/* 字体图标 */
@font-face {
font-family: 'iconfont';
src: url('../fonts/iconfont.eot');
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/iconfont.woff2') format('woff2'),
url('../fonts/iconfont.woff') format('woff'),
url('../fonts/iconfont.ttf') format('truetype'),
url('../fonts/iconfont.svg#iconfont') format('svg');
}
/* 京东 顶部start */
.J_event {
height: 80px;
background-color: #000;
}
.J_event a {
display: block;
height: 80px;
position: relative;
background: url(../images/top.jpg) no-repeat;
}
.J_event a i {
width: 20px;
height: 20px;
position: absolute;
right: 0;
top: 5px;
font-family: "iconfont" !important;
font-style: normal;
text-align: center;
line-height: 20px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #fff;
background-color: rgba(255,255,255,0.3);
}
/* 京东 顶部样式 */
/*京东导航栏开始*/
.shortcut {
height: 30px;
line-height: 30px;
background-color: #E3E4E5;
border-bottom: 1px solid #DDDDDD;
color: #9D9D9D;
font-size: 12px;
}
.w .fl li i{
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: red;
font-size: 22px;
margin-left: 200px;
}
.shortcut a {
color: #9D9D9D;
font-size: 12px;
text-decoration: none;
}
.shortcut a:hover {
color: #c81623;
}
.shortcut .fr li {
float: left;
}
.spacer {
width: 1px;
height: 10px;
background-color: #ccc;
margin: 10px 10px 0;
}
.dropdown i {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: middle;
}
/*京东导航栏结束*/
/* header 部分 start */
.header {
height: 140px;
}
.inner {
height: 140px;
background-color: pink;
position: relative;
}
/* header 部分 end */
.logo {
width: 190px;
height: 170px;
position: absolute;
top: -30px;
left: 0;
background-color: purple;
box-shadow: 0 -12px 10px rgba(0,0,0,.2);
}
.logo h1 {
margin: 0;
}
.logo a {
display: block;
width: 190px;
height: 170px;
background: url(../images/logo.jpg) no-repeat;
text-indent: -99999px;
overflow: hidden;
}
.search {
width: 550px;
height: 35px;
position: absolute;
top: 25px;
left: 320px;
}
.search input {
width: 493px;
height: 33px;
border: 1px solid #F10215;
padding-left: 5px;
outline: none; /* 取消蓝色边框 */
color: #989898;
float: left;
}
.search button {
width: 50px;
height: 39px;
background-color: #F10215;
float: left;
cursor: pointer; /* 鼠标变成小手 */
outline: none;
vertical-align: middle;
}
.search i {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: white;
}
.search em {
position: absolute;
top: 10px;
right: 65px;
width: 19px;
height: 15px;
cursor: pointer;
background: url(../images/sprite-search.png) no-repeat;
}
.search em:hover {
background-position: -30px 0;
}
.hotwords {
position: absolute;
top: 70px;
left: 320px;
}
.hotwords a {
color: #9E9B99;
font-size: 12px;
}
.hotwords a:hover {
color: #f10215;
}
.myCar {
width: 188px;
height: 33px;
border: 1px solid #ccc;
position: absolute;
top: 25px;
right: 100px;
text-align: center;
line-height: 33px;
}
.myCar a {
font-size: 12px;
color: #f10215;
}
.myCar i {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: red;
}
.myCar s {
position: absolute;
top: 5px;
left: 140px;
text-decoration: none;
background-color: #f10215;
height: 16px;
line-height: 16px;
font-size: 12px;
padding: 0 3px;
border-radius: 7px;
color: #fff;
}
.computer {
position: absolute;
right: 0;
bottom: 10px;
}
/* 导航栏信息模块 */
.navitems {
position: absolute;
left: 200px;
bottom: 0;
}
.navitems ul {
float: left;
}
.navitems ul li{
float: left;
margin-left: 30px;
}
.navitems li a {
font-size: 16px;
color: #555A5F;
font-weight: 700;
height: 40px;
line-height: 40px;
display: block;
}
.navitems li a:hover {
color: #f10215;
}
.navitems .spacer {
float: left;
margin-top: 15px;
margin-left: 20px;
margin-right: -10px;
}
/* footer 开始啦 */
.footer {
height: 560px;
background-color: #EAEAEA;
}
.footer-service {
border-bottom: 1px solid #DEDEDE;
}
.footer-service-inner {
padding: 30px 0;
}
.footer-service-inner li {
float: left;
width: 297px;
height: 42px;
}
.service_unit {
width: 225px;
height: 42px;
margin: 0 auto;
position: relative;
}
.service_unit h5 {
width: 36px;
height: 42px;
position: absolute;
top: 0;
left: 0;
background: url(../images/ico_service.png) no-repeat;
text-indent: -999px;
overflow: hidden;
}
.service_unit p {
line-height: 42px;
margin-left: 45px;
font-size: 18px;
font-weight: 700;
}
.service_unit .kuai {
background-position: 0 -44px;
}
.service_unit .hao {
background-position: 0 -86px;
}
.service_unit .sheng {
background-position: 0 -128px;
}
.help {
height: 180px;
/* background-color: pink; */
padding-top: 20px;
}
.help dl {
float: left;
width: 195px;
}
.help dt {
font-size: 14px;
font-weight: 700;
color: #666;
height: 30px;
}
.help dd {
height: 22px;
}
.help dd a{
color: #727272;
font-size: 12px;
}
.help dd a:hover {
color: #f10215;
}
.help .cover {
float: right;
width: 207px;
height: 150px;
background: url(../images/ico_footer.png) no-repeat;
}
.cover dt {
text-align: center;
}
.help .info {
width: 175px;
height: 50px;
font-size: 12px;
margin-top: 5px;
margin-left: 10px;
line-height: 18px;
color: #727272;
}
.more {
text-align: right;
padding-right: 10px;
}
/* 版权模块 */
.copyright {
border-top: 1px solid #ccc;
padding-top: 15px;
}
.links {
text-align: center;
}
.links a {
color: #727272;
font-size: 12px;
}
.links span {
font-size: 12px;
color: #D4CDCD;
margin: 0 6px;
}
.c-info {
font-size: 12px;
color: #9E9E9B;
text-align: center;
line-height: 20px;
margin-top: 10px;
}
.tupian {
text-align: center;
margin-top: 10px;
}
.tupian a{
width: 103px;
height: 32px;
display: inline-block;
background: url(../images/ico_footer.png) no-repeat 0 -151px;
}
.tupian .kexin {
background-position: -104px -151px;
}