html代码:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>京东</title><meta name="description" content="京东JD.COM-专业的综合网上购物商城,销售家电、数码通信、电脑、家居百货、服装服饰、母婴、图书、食品等数万个品牌优质商品.便捷、诚信的服务,为您提供愉悦的网上购物体验!" /><!-- 为搜索引擎搜素时提供关键字,以便更快的找到该网站的主打产品 --><meta name="Keywords" content="网上购物,网上商城,手机,笔记本,MP3,CD,VCD,DV,相机,数码,配件,手表,存储卡,京东" />
<!--     引入页面的小图标,type="image/x-icon"也可省略不写 --><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /><link rel="stylesheet" href="css/normalize.css" /><link rel="stylesheet" href="css/base.css" />
</head>
<body><header><div class="w"><a href="#"><img src="data:images/header.jpg" alt=""></a></div></header><!-- 快速导航栏部分start --><div class="shortcut"><div class="w"><ul class="fl city"><li><i class="f10"></i><a href="">北京</a></li></ul><ul class="fr"><li><a href="#">您好,请登陆</a><a href="#" class="f10">免费注册</a></li><li class="space"></li><li><a href="#">我的订单</a></li><li class="space"></li><!-- 每个之间添加小竖线 --><li><a href="#">我的京东</a><i></i></li><li class="space"></li><li><a href="#">京东会员</a></li><li class="space"></li><li><a href="#">企业采购</a></li><li class="space"></li><li><a href="#">客户服务</a><i></i></li><li class="space"></li><li><a href="#">网站导航</a><i></i></li><li class="space"></li><li><a href="#" class="mobile">手机京东<img src="data:images/mobile.png" height="60" width="60" alt="">  </a></li></ul></div></div><!-- 快速导航栏部分end --><!-- 中间头部分start --><div class="w middle"><div class="logo"><!-- logo的固定写法 --><h1><!-- 提高权重,便于搜索引擎优化 --><a href="#"></a></h1></div><!-- 搜索 --><div class="form"><input type="text" placeholder="扫描仪"><button><i></i></button></div><!-- 购物车 --><div class="shopCar"><i></i><a href="#" class="f10">我的购物车</a><span>0</span></div><!-- 关键词 --><div class="hotwords"><a href="#" class="f10">199减100</a><a href="#">鼠标试用</a><a href="#">农资7折</a><a href="#">低至29元</a><a href="#">抽奖赢空调</a><a href="#">记忆棉</a><a href="#">坐垫</a><a href="#">1分钱买油</a><a href="#">智能手表</a></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 class="space"></li><li><a href="#">服装城</a></li><li><a href="#">京东超市</a></li><li><a href="#">生鲜</a></li><li><a href="#">全球购</a></li><li class="space"></li><li><a href="#">京东金融</a></li></ul></div><!-- 超级日部分 --><div class="super"><a href="#"><img src="data:images/super.png" height="40" width="190" alt=""></a></div></div><!-- 中间头部分end --><!-- 页面底部分start --><footer><!-- 服务模块 --><div class="service"><div class="w"><ul><li><h5>多</h5><p>品类齐全,轻松购物</p></li><li><h5>多</h5><p>多仓直发,极速配送</p></li><li><h5>多</h5><p>正品行货,精致服务</p></li><li><h5>多</h5><p>天天低价,畅选无忧</p></li></ul></div></div><!-- 帮助模块 --><div class="w help"><div class="fl"><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="#">211限时达</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></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></dl><dl><dt>特色服务</dt><dd><a href="#">夺宝岛</a></dd><dd><a href="#">DIY装机</a></dd><dd><a href="#">延保服务</a></dd><dd><a href="#">京东E卡</a></dd><dd><a href="#">京东通信</a></dd><dd><a href="#">京东JD+</a></dd></dl></div><div class="fr coverage"><h5>京东自营覆盖区县</h5><p>京东已向全国2661个区县提供自营配送服务,支持货到付款、POS机刷卡和售后上门服务。</p><a href="#">查看详情 > </a></div></div><!-- 底部版权 --><div class="w copyright"><p> <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="#">京东公益</a><span>|</span> <a href="#">English Site</a><span>|</span> <a href="#">Media & IR</a><span>|</span></p><div><p>京公网安备 11000002000088号<span>|</span>京ICP证070359号<span>|</span>互联网药品信息服务资格证编号(京)-经营性-2014-0008<span>|</span>新出发京零 字第大120007号</p>
<p>互联网出版许可证编号新出网证(京)字150号<span>|</span>出版物经营许可证<span>|</span>网络文化经营许可证京网文[2014]2148-348号<span>|</span>违法和不良信息举报电话:4006561155</p>
<p>Copyright © 2004 - 2017  京东JD.com 版权所有|消费者维权热线:4006067733经营证照
京东旗下网站:京东支付|京东云</p></div><p class="foot-icon"><a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a></p></div></footer><!-- 页面底部分end -->
</body>
</html>

css代码:

@charset = 'UTF-8';
.w{width: 1190px;/*京东的版心是1190*/margin: 0 auto;
}
/*浮动的公共类*/
.fl{float: left;
}
.fr{float:right;
}
a{text-decoration: none;font-size:12px;color: #999;
}
a:hover{color: #c81623;
}
blockquote,body,button,dd,dl,dt,fieldset,h1,h2,h3,h4,h5,h6,
hr,input,legend,li,ol,p,pre,td,textarea,th,ul{margin: 0;padding: 0;
}
input,button{border: 0;outline: none;/*取消轮廓边框*/
}
ul{list-style: none;
}
body{background-color:#f6f6f6;
}
.f10{color:#f10215!important;/*!important增加权重*/
}
@font-face {/*声明字体*/font-family: 'icomoon';src:  url('../fonts/icomoon.eot?hly75v');src:  url('../fonts/icomoon.eot?hly75v#iefix') format('embedded-opentype'),url('../fonts/icomoon.ttf?hly75v') format('truetype'),url('../fonts/icomoon.woff?hly75v') format('woff'),url('../fonts/icomoon.svg?hly75v#icomoon') format('svg');font-weight: normal;font-style: normal;
}/*header部分*/
header{height: 80px;background-color: #020000;
}
/*快速导航栏部分start*/
.shortcut{height: 30px;line-height: 30px;background-color: #e3e4e5;border-bottom: 1px solid #ddd;
}
.city{margin-left: 200px;
}
.shortcut li{float: left;
}
.shortcut i{font-family: "icomoon";font-style: normal;/*让倾斜的不倾斜*/color: #ccc;
}
.space{/*小竖线的做法*/width: 1px;height: 10px;background-color: #ccc;margin: 10px 12px 0px;/* 上10 左右12 下0*/
}
.mobile{position: relative;
}
.mobile img{position: absolute;left: -3px;top:24px;border: 1px solid #ccc;padding: 3px;}
/*header部分end*//*中间大部分*/
.middle{height: 140px;background-color:;position: relative;
}
.logo{position: absolute;top: -30px;left: 0;
}
.logo a{display: block;width: 190px;height: 170px;background: #fff url(../images/logo.png) no-repeat;box-shadow: 0px -10px 10px rgba(0, 0, 0, 0.3)}/*搜索框*/
.form{width: 550px;height: 35px;position: absolute;top: 25px;left: 320px;
}
.form input{width: 495px;height: 33px;border: 1px solid #f10215;float: left;font-size: 14px;padding-left: 3px;
}
.form button{width: 50px;height: 35px;background-color: #f10215;float: left;
}
.form button i{font-family: 'icomoon';font-style: normal;color: #fff;}/*购物车*/
.shopCar{width: 188px;height: 33px;line-height: 33px;border: 1px solid #ccc;position: absolute;top: 25px;right: 95px;background-color: #fff;text-align: center;
}
.shopCar i{font-family: 'icomoon';font-style: normal;margin-right: 5px;color: #f10215;
}
.shopCar span{width: 15px;height: 15px;background-color: #f10215;border-radius: 50%;position: absolute;top: 5px;right: 30px;font-size:12px;color: #fff;line-height: 15px;
}/*关键词模块*/
.hotwords{position: absolute;top: 68px;left: 320px;
}/*小导航模块*/
.navitems{width: 770px;height: 40px;position: absolute;bottom: 0;left: 200px;line-height: 40px;
}
.navitems li{float: left;margin-left: 30px;
}
.navitems li a{font-size: 16px;font-weight: 700;color: #555;
}
.navitems li a:hover{color: #f10215;
}
.navitems .space{/*margin-top: 15px;margin-left: 15px;margin-right: -15px;*/margin: 15px -15px 0 15px;/*上右下左--顺时针转*/
}/*超级日模块*/
.super{position: absolute;bottom: 5px;right: 0;
}/*页面底部*/
footer{margin-top: 35px;height: 500px;background-color: #EAEAEA;
}
footer a{color: #666;
}
.service{padding: 30px 0;border-bottom: 1px solid #DEDEDE;overflow: hidden;/*清除浮动*/
}
.service ul li{width: 297px;height: 43px;position: relative;line-height:43px;float: left;
}
.service li h5{position: absolute;top: 0;left: 38px;width: 36px;height: 43px;background: url(../images/ico.png) no-repeat;text-indent: -999em;/*首行缩进*/
}
.service li p{font-weight: 700;margin-left: 82px;
}
.service li:nth-child(2) h5{background-position: 0 -43px;
}
.service li:nth-child(3) h5{background-position: 0 -86px;
}
.service li:nth-child(4) h5{background-position:bottom;
}/*帮助模块*/
.help{height: 200px;border-bottom: 1px solid #DEDEDE;padding-top:25px;box-sizing: border-box;
}
.help dl{width: 192px;float: left;
}
.help dt,
.coverage h5{height: 30px;font-size: 14px;color: #666;
}
.help dd{height: 22px;
}/*范围*/
.coverage{width: 200px;height: 150px;background:url(../images/ico_footer.png) no-repeat;
}
.coverage h5{padding-left: 35px;
}
.coverage p{font-size: 12px;color: #666;line-height: 18px;width: 180px;
}
.coverage a{display: block;margin-top: 5px;width: 180px;text-align: right;
}/*底部版权*/
.copyright {padding-top: 20px;text-align: center;color: #666;font-size: 12px;
}
.copyright span {margin: 0  10px;
}.copyright div {margin-top:20px;
}
.copyright div p {line-height: 22px;
}
.foot-icon a {display: inline-block;width: 103px;height: 33px;background: url(../images/ico_footer.png) no-repeat 0 -150px;margin: 20px 4px 0;/* 行内块可以用 text-align: center 来实现居中 */
}
.foot-icon a:nth-child(2) {background-position: -103px -150px;
}
.foot-icon a:nth-child(3) {background-position: 0 -183px;
}.foot-icon a:nth-child(4) {background-position: -103px -183px;
}.foot-icon a:nth-child(5) {background-position: 0 -216px;
}.foot-icon a:nth-child(6) {background-position: -103px -216px;
}

一般我们在书写css代码之前总要对页面进行初始化:

我们一般用normalize.css

/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */
/*
http://necolas.github.io/normalize.css/
*/
/*** 1. Change the default font family in all browsers (opinionated).* 2. Correct the line height in all browsers.* 3. Prevent adjustments of font size after orientation changes in*    IE on Windows Phone and in iOS.*//* Document========================================================================== */html {font-family: sans-serif; /* 1 */line-height: 1.15; /* 2 */-ms-text-size-adjust: 100%; /* 3 */-webkit-text-size-adjust: 100%; /* 3 */
}/* Sections========================================================================== *//*** Remove the margin in all browsers (opinionated).*/body {margin: 0;
}/*** Add the correct display in IE 9-.*/article,
aside,
footer,
header,
nav,
section {display: block;
}/*** Correct the font size and margin on `h1` elements within `section` and* `article` contexts in Chrome, Firefox, and Safari.*/h1 {font-size: 2em;margin: 0.67em 0;
}/* Grouping content========================================================================== *//*** Add the correct display in IE 9-.* 1. Add the correct display in IE.*/figcaption,
figure,
main { /* 1 */display: block;
}/*** Add the correct margin in IE 8.*/figure {margin: 1em 40px;
}/*** 1. Add the correct box sizing in Firefox.* 2. Show the overflow in Edge and IE.*/hr {box-sizing: content-box; /* 1 */height: 0; /* 1 */overflow: visible; /* 2 */
}/*** 1. Correct the inheritance and scaling of font size in all browsers.* 2. Correct the odd `em` font sizing in all browsers.*/pre {font-family: monospace, monospace; /* 1 */font-size: 1em; /* 2 */
}/* Text-level semantics========================================================================== *//*** 1. Remove the gray background on active links in IE 10.* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.*/a {background-color: transparent; /* 1 */-webkit-text-decoration-skip: objects; /* 2 */
}/*** Remove the outline on focused links when they are also active or hovered* in all browsers (opinionated).*/a:active,
a:hover {outline-width: 0;
}/*** 1. Remove the bottom border in Firefox 39-.* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.*/abbr[title] {border-bottom: none; /* 1 */text-decoration: underline; /* 2 */text-decoration: underline dotted; /* 2 */
}/*** Prevent the duplicate application of `bolder` by the next rule in Safari 6.*/b,
strong {font-weight: inherit;
}/*** Add the correct font weight in Chrome, Edge, and Safari.*/b,
strong {font-weight: bolder;
}/*** 1. Correct the inheritance and scaling of font size in all browsers.* 2. Correct the odd `em` font sizing in all browsers.*/code,
kbd,
samp {font-family: monospace, monospace; /* 1 */font-size: 1em; /* 2 */
}/*** Add the correct font style in Android 4.3-.*/dfn {font-style: italic;
}/*** Add the correct background and color in IE 9-.*/mark {background-color: #ff0;color: #000;
}/*** Add the correct font size in all browsers.*/small {font-size: 80%;
}/*** Prevent `sub` and `sup` elements from affecting the line height in* all browsers.*/sub,
sup {font-size: 75%;line-height: 0;position: relative;vertical-align: baseline;
}sub {bottom: -0.25em;
}sup {top: -0.5em;
}/* Embedded content========================================================================== *//*** Add the correct display in IE 9-.*/audio,
video {display: inline-block;
}/*** Add the correct display in iOS 4-7.*/audio:not([controls]) {display: none;height: 0;
}/*** Remove the border on images inside links in IE 10-.*/img {border-style: none;
}/*** Hide the overflow in IE.*/svg:not(:root) {overflow: hidden;
}/* Forms========================================================================== *//*** 1. Change the font styles in all browsers (opinionated).* 2. Remove the margin in Firefox and Safari.*/button,
input,
optgroup,
select,
textarea {font-family: sans-serif; /* 1 */font-size: 100%; /* 1 */line-height: 1.15; /* 1 */margin: 0; /* 2 */
}/*** Show the overflow in IE.* 1. Show the overflow in Edge.*/button,
input { /* 1 */overflow: visible;
}/*** Remove the inheritance of text transform in Edge, Firefox, and IE.* 1. Remove the inheritance of text transform in Firefox.*/button,
select { /* 1 */text-transform: none;
}/*** 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`*    controls in Android 4.* 2. Correct the inability to style clickable types in iOS and Safari.*/button,
html [type="button"], /* 1 */
[type="reset"],
[type="submit"] {-webkit-appearance: button; /* 2 */
}/*** Remove the inner border and padding in Firefox.*/button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {border-style: none;padding: 0;
}/*** Restore the focus styles unset by the previous rule.*/button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {outline: 1px dotted ButtonText;
}/*** Change the border, margin, and padding in all browsers (opinionated).*/fieldset {border: 1px solid #c0c0c0;margin: 0 2px;padding: 0.35em 0.625em 0.75em;
}/*** 1. Correct the text wrapping in Edge and IE.* 2. Correct the color inheritance from `fieldset` elements in IE.* 3. Remove the padding so developers are not caught out when they zero out*    `fieldset` elements in all browsers.*/legend {box-sizing: border-box; /* 1 */color: inherit; /* 2 */display: table; /* 1 */max-width: 100%; /* 1 */padding: 0; /* 3 */white-space: normal; /* 1 */
}/*** 1. Add the correct display in IE 9-.* 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.*/progress {display: inline-block; /* 1 */vertical-align: baseline; /* 2 */
}/*** Remove the default vertical scrollbar in IE.*/textarea {overflow: auto;
}/*** 1. Add the correct box sizing in IE 10-.* 2. Remove the padding in IE 10-.*/[type="checkbox"],
[type="radio"] {box-sizing: border-box; /* 1 */padding: 0; /* 2 */
}/*** Correct the cursor style of increment and decrement buttons in Chrome.*/[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {height: auto;
}/*** 1. Correct the odd appearance in Chrome and Safari.* 2. Correct the outline style in Safari.*/[type="search"] {-webkit-appearance: textfield; /* 1 */outline-offset: -2px; /* 2 */
}/*** Remove the inner padding and cancel buttons in Chrome and Safari on macOS.*/[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {-webkit-appearance: none;
}/*** 1. Correct the inability to style clickable types in iOS and Safari.* 2. Change font properties to `inherit` in Safari.*/::-webkit-file-upload-button {-webkit-appearance: button; /* 1 */font: inherit; /* 2 */
}/* Interactive========================================================================== *//** Add the correct display in IE 9-.* 1. Add the correct display in Edge, IE, and Firefox.*/details, /* 1 */
menu {display: block;
}/** Add the correct display in all browsers.*/summary {display: list-item;
}/* Scripting========================================================================== *//*** Add the correct display in IE 9-.*/canvas {display: inline-block;
}/*** Add the correct display in IE.*/template {display: none;
}/* Hidden========================================================================== *//*** Add the correct display in IE 10-.*/[hidden] {display: none;
}

下面我们来看页面效果图:

京东通用header和footer相关推荐

  1. Android listView 去掉header和footer中的分割线

    Android listView 去掉header和footer中的分割线 方法一: 在listView中加上android:headerDividersEnabled="false&quo ...

  2. RecyclerView添加header与footer

    前言 这次主要关于RecyclerView添加header和footer的实现方法,我们都知道,在使用ListView的时候我们能自由的给自己的ListView添加头部与尾部.使用addHeaderV ...

  3. 隐藏JqueryMobile中的Header与Footer

    <script type="text/javascript"> $(function () {//考虑你header和footer都存在var activePage = ...

  4. delphi xe6 android ListView增加 Header或Footer 的方法

    var   Item1: TListViewItem; begin     Item1 := ListView1.Items.Add;     Item1.Purpose:=TListItemPurp ...

  5. 实现带header和footer功能的RecyclerView——完善篇

    在上一篇文章中我们实现了实现带header和footer功能的RecyclerView,见  实现带header和footer功能的RecyclerView 但是由于加入了header,item的po ...

  6. 实现带header和footer功能的RecyclerView

    这个项目很简单,其实一年前就开发完成了,但是一直没闲下来去整理. RecyclerView是Android 5.0版本引入的一个新的组件,目的是在一些场景中取代之前ListView和GridView, ...

  7. GridView空记录时显示Header和Footer

    也有段日子没写什么东西了,也是因为以前闲了好长时间,最近一下又有活干了,也不是什么新任务,还是接着原来没做完的工作重新设计和动工,对原来做好的曲线图形开发一个常用属性的设置,普通用户就可以通过页面对图 ...

  8. StroyBoard中UICollectionView中添加Header和footer

    到Storyboard中,选择collection view controller中的"Collection View".在Attributes inspector中,选择&quo ...

  9. HTML5的非主体结构元素(header、footer、hgroup、assress)

    header元素 footer元素 hgroup元素 address元素 网页编排规则 1.header元素 代码演示: <!DOCTYPE html> <html lang=&qu ...

最新文章

  1. Java NIO(New I/O)的三个属性position、limit、capacity
  2. 沙利文:奢侈品防伪领域RFID技术作用巨大
  3. windows mobile 鼠标等待
  4. SVM的发展和研究热点
  5. matlab dsp实验报告,matlab实验报告14.pdf
  6. 洛谷 1057——传球游戏(递推与递归二分)
  7. ADO.NET2.0的十大新特性
  8. python人脸识别opencv_用python和opencv 做人脸识别
  9. 软件构造学习笔记-第九周、第十周
  10. tinymce vue 部分工具不显示_tinymce-vue使用问题及解决记录
  11. Linux系统编程(七)消息队列
  12. SpringBoot整合kafka之kafka分区实战
  13. SAP系统如何打NOTE?
  14. oracle12c安装教程
  15. 安装oracle数据库过程中系统表空间,Oracle数据库安装及配置
  16. 免费的思维导图软件都有哪些?
  17. Windows Server 2008 各版本介绍
  18. DistilBert解读
  19. win10用什么清理垃圾好?
  20. 安全之路 —— C/C++开3389端口(远程终端)

热门文章

  1. 【线性代数】标量、向量、矩阵和张量(scalar, vector, matrix tensor)
  2. ihs服务器限制文件上传,请教IHS配置问题
  3. Easyx基本使用(二)
  4. git revert 的操作
  5. java modbus lrc,Modbus ASCII RTU LRC CRC 校验
  6. 外食孕妈咪的营养计划
  7. janus流媒体服务器搭建
  8. lhgDialog窗口组件
  9. cv2最强仿射变换(支持n点对齐,可进行人脸对齐)
  10. java替换换行符_Java的replace替换字符串中的回车换行符的方法