HTML和CSS实现京东首页(html和css详解)(二)

简介: HTML和CSS实现京东首页(html和css详解)

HTML和CSS实现京东首页(html和css详解)(一)https://developer.aliyun.com/article/1382397


CSS代码如下:

(1)base部分代码如下:

/*
* @Author: apple
* @Date:   2017-07-25 11:10:42
* @Last Modified by:   apple
* @Last Modified time: 2017-07-27 00:20:43
*/
img {
  /* display: block; */
  vertical-align: top; /* 解决图片底测有空白缝隙的问题 */
}
.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,form,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;
}
@font-face {  /* 声明字体 */
  font-family: 'icomoon';
  src:  url('https://developer.aliyun.com/fonts/icomoon.eot?8qhwk5');
  src:  url('https://developer.aliyun.com/fonts/icomoon.eot?8qhwk5#iefix') format('embedded-opentype'),
    url('https://developer.aliyun.com/fonts/icomoon.ttf?8qhwk5') format('truetype'),
    url('https://developer.aliyun.com/fonts/icomoon.woff?8qhwk5') format('woff'),
    url('https://developer.aliyun.com/fonts/icomoon.svg?8qhwk5#icomoon') format('svg');
  font-weight: normal;
  font-style: normal;
}
/* header部分 */
header {
  height: 80px;
  background-color: #020000;
}
/* 快速导航栏begin */
.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 0;  /* 上 10  左右是 12  下是 0 */
}
.mobile {
  position: relative;
}
.mobile img {
  position: absolute;
  left: -3px;
  top: 24px;
  border: 1px solid #ccc;
  padding: 3px;
}
/* 快速导航栏over */
/* 中间大部分 */
.middle {
  height: 140px;
  position: relative;
}
.logo {
  position: absolute;
  top: -30px;
  left: 0;
  box-shadow: 0px -10px 10px rgba(0,0,0,.3);
}
.logo a {
  display: block;
  width: 190px;
  height: 170px;
  background: #fff url(https://developer.aliyun.com/images/logo.png) no-repeat;
}
/* 搜索框 */
.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;
  color: #f10215;
}
.shopCar i {
  font-family: 'icomoon';
  margin-right: 5px;
  font-style: normal;
}
.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: 10px;
  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(https://developer.aliyun.com/images/ico.png) no-repeat;
  text-indent: -999em;
}
.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;
}
.service  li p {
  font-weight: 700;
  margin-left: 82px;
}
/* 帮助模块 */
.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(https://developer.aliyun.com/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(https://developer.aliyun.com/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;
}


HTML和CSS实现京东首页(html和css详解)(三)https://developer.aliyun.com/article/1382399

相关文章
|
6月前
|
移动开发 前端开发 JavaScript
征信报告修改器,征信报告生成器,制作软件无痕修改软件【js+html+css】
本项目为信用评分模拟器教学工具,采用HTML5实现,仅供学习参考。核心功能通过JavaScript构建,包含虚拟数据生成、权重分配及信用因素分析(如还款记录、信用使用率等)。
|
6月前
|
前端开发 JavaScript
个人征信电子版无痕修改, 个人信用报告pdf修改,js+html+css即可实现【仅供学习用途】
本代码展示了一个信用知识学习系统的前端实现,包含评分计算、因素分析和建议生成功能。所有数据均为模拟生成
|
6月前
|
存储 前端开发 JavaScript
仿真银行app下载安装, 银行卡虚拟余额制作app,用html+css+js实现逼真娱乐工具
这是一个简单的银行账户模拟器项目,用于学习前端开发基础。用户可进行存款、取款操作,所有数据存储于浏览器内存中
|
6月前
|
前端开发 容器
处方单图片生成器, 处方单在线制作免费,js+css+html恶搞神器
这是一个电子处方模拟生成系统,使用html2canvas库实现图片导出功能。系统生成的处方单包含多重防伪标识,并明确标注为模拟数据,仅供学习
|
6月前
|
前端开发
个人征信PDF无痕修改软件,个人征信模板可编辑,个人征信报告p图神器【js+html+css仅供学习用途】
这是一款信用知识学习系统,旨在帮助用户了解征信基本概念、信用评分计算原理及信用行为影响。系统通过模拟数据生成信用报告,涵盖还款记录
|
6月前
|
前端开发 JavaScript 容器
制作b超单生成器, 假怀孕b超单图片制作, p图医院证明【css+html+js装逼恶搞神器】
本资源提供一个适合用于熟人之间恶搞的工具,效果逼真,仅供学习参考与娱乐。包含前端技术学习要点:语义化布局、响应式设计、Flexbox、图片自适应
|
6月前
|
前端开发
医院检查单子p图软件,在线制作仿真病历,js+css+html装逼神器
本示例展示如何用HTML/CSS创建医疗信息页面,内容仅供学习参考。页面模拟“阳光医院体检中心”场景,提供预约功能验证(如姓名、手机号、日期)。所有数据仅用于演示
|
6月前
|
存储 自然语言处理 前端开发
抖音快手小红书虚拟评论截图生成器,模拟对话制作工具,html+js+css
这是一款纯前端实现的多平台虚拟评论生成器,支持抖音、快手、小红书风格,适用于产品演示与UI设计。采用Vanilla JS与Flexbox布局,利用IndexedDB存储数据,CSS Variables切换主题。
|
6月前
|
存储 前端开发 安全
病历单生成器在线制作,病历单生成器app,HTML+CSS+JS恶搞工具
本项目为医疗病历模拟生成器,旨在为医学教学和软件开发测试提供数据支持,严格遵守《医疗机构病历管理规定》。