• 目录

    • 目录架构
    • css/index.css
    • /index.html
    • js/index.js
    • css/normalize.css

目录架构

css/index.css

@font-face {font-family: 'icomoon';src: url('../fonts/icomoon.eot?8ahhy7');src: url('../fonts/icomoon.eot?8ahhy7#iefix') format('embedded-opentype'),url('../fonts/icomoon.ttf?8ahhy7') format('truetype'),url('../fonts/icomoon.woff?8ahhy7') format('woff'),url('../fonts/icomoon.svg?8ahhy7#icomoon') format('svg');font-weight: normal;font-style: normal;font-display: block;
}body {min-width: 320px;max-width: 540px;margin: 0 auto;color: #000000;background-color: #f2f2f2;-webkit-tap-highlight-color: transparent;
}* {margin: 0;padding: 0;
}a {text-decoration: none;
}div {box-sizing: border-box;
}ul li {list-style: none;
}.search-index {display: flex;position: fixed;top: 0;left: 50%;transform: translateX(-50%);width: 100%;height: 44px;min-width: 320px;max-width: 540px;background: -webkit-linear-gradient(rgb(114,136,153),rgb(196,216,229));opacity: 0.7;transition: all .5s;
}.search-index .search {position: relative;flex: 1;height: 26px;margin: 6px 10px;font-size: 12px;line-height: 24px; /*因为采用的c3模型,要减去上下padding*/padding-left: 25px;color: #666666;border: 1px solid #cccccc;border-radius: 50px;
}.search-index .search::before {content: ""; /*必须写, 不然不显示*/position: absolute;display: block;top: 5px;left: 5px;width: 19px;height: 19px;background: url("../images/pic.png") no-repeat 0 0px;background-size: 21px auto;
}.search-index .user {width: 44px;height: 44px;text-align: center;/*background: url("../images/pic.png") no-repeat 0 -41px;*//*background-size: 21px auto;*/font-size: 12px;color: white;
}.search-index .user::before {content: ""; /*必须写, 不然不显示*/display: block;width: 22px;height: 22px;margin: 3px auto;background: url("../images/pic.png") no-repeat 0 -35px;background-size: 21px auto;
}.focus img {width: 100%;
}.local-nav {display: flex;height: 64px;background-color: white;border-radius: 8px;margin: 3px 4px;
}.local-nav li {flex: 1;
}.local-nav a {display: flex;flex-direction: column; /*主轴y轴*/align-items: center; /*侧轴居中*/color: #222222;font-size: 12px;
}.local-nav li [class^='local-nav-icon'] { /*属性选择器,以local-nav-icon开头*/width: 40px;height: 40px;margin-top: 8px;background: url("../images/pic2.png") 0 0 no-repeat;background-size: 40px auto;
}.local-nav li .local-nav-icon-icon2 {background-position: 0 -40px;
}.local-nav li .local-nav-icon-icon3 {background-position: 0 -80px;
}.local-nav li .local-nav-icon-icon4 {background-position: 0 -120px;
}.local-nav li .local-nav-icon-icon5 {background-position: 0 -160px;
}nav {overflow: hidden;border-radius: 8px;margin: 0 4px 3px;
}.nav-common {display: flex;height: 88px;background-color: pink;
}.nav-common:nth-child(1) {background: -webkit-linear-gradient(left, rgb(250, 90, 86), rgb(251, 131, 80));
}.nav-common:nth-child(2) {margin: 3px 0;background: -webkit-linear-gradient(left, rgb(75, 144, 237), rgb(83, 187, 237));
}.nav-common:nth-child(3) {background: -webkit-linear-gradient(left, rgb(53, 194, 169), rgb(107, 213, 88));
}.nav-common .nav-items {flex: 1;display: flex;flex-direction: column;
}.nav-common .nav-items:nth-child(-n+2) {border-right: 1px solid #ffffff;
}.nav-common .nav-items a {flex: 1;color: #ffffff;font-size: 14px;text-align: center;text-shadow: 1px 1px rgb(0, 0, .2);line-height: 44px;
}.nav-common .nav-items:nth-child(1) a {background: url("../images/bg1.png") no-repeat bottom right;line-height: 80px;text-align: left;padding: 0 20px;background-size: 73px auto;
}.nav-common:nth-child(2) .nav-items:nth-child(1) a {background: url("../images/bg2.png") no-repeat bottom right;background-size: 73px auto;
}.nav-common:nth-child(3) .nav-items:nth-child(1) a {background: url("../images/bg3.png") no-repeat bottom right;background-size: 73px auto;
}.nav-common .nav-items a:nth-child(1) {border-bottom: 1px solid #ffffff;
}.nav-common .nav-items:nth-child(1) a {border-bottom: none;
}.subnav-entry {display: flex;flex-wrap: wrap;border-radius: 8px;background-color: #fff;margin: 0 4px;
}.subnav-entry li {/*flex支持百分比*/flex: 20%;margin-top: 5px;
}.subnav-entry li a {display: flex;flex-direction: column;align-items: center;font-size: 12px;
}[class^='subnav-entry-icon'] {width: 28px;height: 28px;/*margin-top: 4px;*/background: url("../images/un_ico_subnav2x@v7.152.png") 0 0 no-repeat;background-size: 28px auto;
}.sales-box {border-top: 1px solid #bbb;background-color: #fff;margin: 10px 0;
}.sales-hd {position: relative;height: 44px;border-bottom: 1px solid #ccc;
}.sales-hd h2 {/*position: relative;*/text-indent: -999px;overflow: hidden;
}.sales-hd h2::after {position: absolute;top: 14px;left: 8px;content: "";width: 79px;height: 15px;background: url(../upload/hot.png) no-repeat 0 -20px;background-size: 79px auto;
}.more {position: absolute;right: 5px;top: 9px;background: -webkit-linear-gradient(left, #FF506C, #FF6BC6);border-radius: 15px;padding: 3px 20px 3px 10px;color: #fff;
}.more::after {content: "";position: absolute;top: 9px;right: 9px;width: 7px;height: 7px;border-top: 2px solid #fff;border-right: 2px solid #fff;transform: rotate(45deg);
}.row {display: flex;
}.row a {flex: 1;border-bottom: 1px solid #eee;
}.row a:nth-child(1) {border-right: 1px solid #eee;
}.row a img {width: 100%;
}.floor {display: flex;
}.floor li {flex: 1;display: flex;flex-direction: column;align-items: center;font-size: 12px;line-height: 25px;
}
.floor li::before {font-size: 20px;color: skyblue;
}
.floor li:nth-child(1)::before{font-family: icomoon;content: '\e942';
}
.floor li:nth-child(2)::before{font-family: icomoon;content: '\e9c7';
}
.floor li:nth-child(3)::before{font-family: icomoon;content: '\e9fa';
}

/index.html

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" href="css/normalize.css"><link rel="stylesheet" href="css/index.css"><script src="js/index.js"></script><title>携程</title></head><body><!--顶部搜索--><div class="search-index"><div class="search">搜索:目的地/酒店/景点/航班号</div><a href="" class="user">我 的</a></div><!--焦点图--><div class="focus"><img src="upload/focus.jpg" alt=""></div><!--导航栏--><ul class="local-nav"><li><a href="" title="攻略·景点"><span class="local-nav-icon-icon1"></span><span>攻略·景点</span></a></li><li><a href="" title="攻略·景点"><span class="local-nav-icon-icon2"></span><span>攻略·景点</span></a></li><li><a href="" title="攻略·景点"><span class="local-nav-icon-icon3"></span><span>攻略·景点</span></a></li><li><a href="" title="攻略·景点"><span class="local-nav-icon-icon4"></span><span>攻略·景点</span></a></li><li><a href="" title="攻略·景点"><span class="local-nav-icon-icon5"></span><span>攻略·景点</span></a></li></ul><!--主导航栏--><nav><div class="nav-common"><div class="nav-items"><a href="">海外酒店</a></div><div class="nav-items"><a href="">海外酒店</a><a href="">特价酒店</a></div><div class="nav-items"><a href="">海外酒店</a><a href="">特价酒店</a></div></div><div class="nav-common"><div class="nav-items"><a href="">海外酒店</a></div><div class="nav-items"><a href="">海外酒店</a><a href="">特价酒店</a></div><div class="nav-items"><a href="">海外酒店</a><a href="">特价酒店</a></div></div><div class="nav-common"><div class="nav-items"><a href="">海外酒店</a></div><div class="nav-items"><a href="">海外酒店</a><a href="">特价酒店</a></div><div class="nav-items"><a href="">海外酒店</a><a href="">特价酒店</a></div></div></nav><!--侧导航栏--><ul class="subnav-entry"><li><a href=""><span class="subnav-entry-icon1"></span><span>自由行</span></a></li><li><a href=""><span class="subnav-entry-icon2"></span><span>自由行</span></a></li><li><a href=""><span class="subnav-entry-icon3"></span><span>自由行</span></a></li><li><a href=""><span class="subnav-entry-icon4"></span><span>自由行</span></a></li><li><a href=""><span class="subnav-entry-icon5"></span><span>自由行</span></a></li><li><a href=""><span class="subnav-entry-icon6"></span><span>自由行</span></a></li><li><a href=""><span class="subnav-entry-icon7"></span><span>自由行</span></a></li><li><a href=""><span class="subnav-entry-icon8"></span><span>自由行</span></a></li><li><a href=""><span class="subnav-entry-icon9"></span><span>自由行</span></a></li><li><a href=""><span class="subnav-entry-icon10"></span><span>自由行</span></a></li></ul><!-- 销售模块 --><div class="sales-box"><div class="sales-hd"><h2>热门活动</h2><a href="#" class="more">获取更多福利</a></div><div class="sales-bd"><div class="row"><a href="#"><img src="upload/p1.png" alt=""></a><a href="#"><img src="upload/p2.jpg" alt=""></a></div></div></div><!--底部菜单--><ul class="floor"><li>电话预定</li><li>下载客户端</li><li>我的</li></ul></body>
</html>

js/index.js

window.addEventListener('load', function () {var subnav_entry = document.querySelector('.subnav-entry');var li = subnav_entry.querySelectorAll('li');var y = 0;for (var i = 0; i < li.length; i++) {li[i].querySelector('span').style.backgroundPosition = '0 -' + y + 'px';y += 28;}var search_index = document.querySelector('.search-index');document.addEventListener('scroll', function () {if (window.pageYOffset > 100) {search_index.style.background = 'white';search_index.style.opacity = '1';console.log(search_index.style.backgroundColor)} else {search_index.style.background = '-webkit-linear-gradient(rgb(114,136,153),rgb(196,216,229))';search_index.style.opacity = '0.7';console.log(search_index.style.background)}})
})

css/normalize.css

/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css *//* Document========================================================================== *//*** 1. Correct the line height in all browsers.* 2. Prevent adjustments of font size after orientation changes in iOS.*/html {line-height: 1.15; /* 1 */-webkit-text-size-adjust: 100%; /* 2 */
}/* Sections========================================================================== *//*** Remove the margin in all browsers.*/body {margin: 0;
}/*** Render the `main` element consistently in IE.*/main {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========================================================================== *//*** 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========================================================================== *//*** Remove the gray background on active links in IE 10.*/a {background-color: transparent;
}/*** 1. Remove the bottom border in Chrome 57-* 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 */
}/*** 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 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========================================================================== *//*** Remove the border on images inside links in IE 10.*/img {border-style: none;
}/* Forms========================================================================== *//*** 1. Change the font styles in all browsers.* 2. Remove the margin in Firefox and Safari.*/button,
input,
optgroup,
select,
textarea {font-family: inherit; /* 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;
}/*** Correct the inability to style clickable types in iOS and Safari.*/button,
[type="button"],
[type="reset"],
[type="submit"] {-webkit-appearance: button;
}/*** 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;
}/*** Correct the padding in Firefox.*/fieldset {padding: 0.35em 0.75em 0.625em;
}/*** 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 */
}/*** Add the correct vertical alignment in Chrome, Firefox, and Opera.*/progress {vertical-align: baseline;
}/*** Remove the default vertical scrollbar in IE 10+.*/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 in Chrome and Safari on macOS.*/[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 Edge, IE 10+, and Firefox.*/details {display: block;
}/** Add the correct display in all browsers.*/summary {display: list-item;
}/* Misc========================================================================== *//*** Add the correct display in IE 10+.*/template {display: none;
}/*** Add the correct display in IE 10.*/[hidden] {display: none;
}

html 模拟携程网首页相关推荐

  1. 移动web开发--移动端常见布局+流式布局和flex布局+携程网首页案例

    浏览器私有前缀 为了兼容老版本 私有前缀 -moz- : fixfox 浏览器私有属性 -ms- : ie浏览器私有属性 -webkit- : safari.chrome私有属性 -o- : Oper ...

  2. 安卓APP_ Fragment(5)—— Fragment + ViewPager2 模拟微信首页 (2)两者联动翻页

    摘自:安卓APP_ Fragment(5)-- Fragment + ViewPager2 模拟微信首页 (2)两者联动实现翻页 作者:丶PURSUING 发布时间: 2021-04-22 00:11 ...

  3. 安卓APP_ Fragment(4)—— Fragment + ViewPager2 模拟微信首页 (1)两者联动实现翻页

    摘自:安卓APP_ Fragment(4)-- Fragment + ViewPager2 模拟微信首页 (1)两者联动实现翻页 作者:丶PURSUING 发布时间: 2021-04-20 17:46 ...

  4. 移动开发—详解flex布局之携程网首页案例制作

    移动开发-详解flex布局之携程网首页案例制作 学习内容 一.flex的布局原理 二.flex布局父项常见的属性 三.flex布局子项常见的属性 四.携程网首页案例制作 一.flex的布局原理 总结f ...

  5. Android:viewpager+ fragment模拟微信首页

    viewpager+ fragment viewpager+ fragment模拟微信首页 1.前言 2.实现 viewpager+ fragment模拟微信首页 1.前言 ViewPager(视图滑 ...

  6. 携程网首页案例(flex布局)

    一.携程网首页案例 访问地址:m.ctrip.com 1. 技术选型 方案:我们采取单独制作移动页面方案 技术:布局采取flex布局 2. 搭建相关文件夹结构 3. 设置视口标签以及引入初始化样式 & ...

  7. Android viewPager2 + fragment 模拟微信首页2(滑动页面标签同步变化,点击标签滑动页面)

    可以实现的方式:BottomNavigationView 这里我们不使用BottomNavigationView,手动来写代码 先看一下效果 fragment + viewPager2模拟微信首页2( ...

  8. 移动WEB开发之flex布局--携程网首页案例制作

    案例:携程网移动端首页 访问地址:携程旅行-酒店预订,机票预订查询,旅游度假,商旅管理-携程无线官网 (ctrip.com) 1. 技术选型 方案:我们采取单独制作移动页面方案 技术:布局采取flex ...

  9. Android 实战之模拟微信首页界面 (java实现)

    哈喽~大家好呀,这篇我们来看看用 java 来实现 模拟微信界面 ,首先我们来看看效果.  开头 首先,我们先看 GIF 图,我们是实现了界面的左滑右滑切换界面与点击下面的图标按钮来实现切换界面的效果 ...

最新文章

  1. pytorch生成对抗示例
  2. 【Java例题】2.1复数类
  3. IDEA+Maven运行调试MapReduce程序
  4. Android中Dialog与DialogFragment的对比
  5. AtCoder Beginner Contest 177总结
  6. PhotoKit 照片库的管理-获取图像
  7. web端怎么做兼容性测试
  8. npm login 登录失败,报E500 Internal Server Error - PUT https://registry.npm.taobao.org/-/user/org.couchdb
  9. logback为日志配置颜色
  10. 阿特拉斯拧紧枪说明书_阿特拉斯使用说明书(全).pdf
  11. 第一次~通过MockingBird进行声音模仿的感悟
  12. 双11后,第一批买家秀曝光……
  13. 计算机相乘求和的函数,Excel五大求和操作,除了sum函数你知道有几个?-excel乘法函数...
  14. ftp服务器文件无法删除,ftp服务器文件删除
  15. STM32F429-Discovery 编译 uclinux
  16. [原创]WIA 学习笔记
  17. 当区块链走进物流——区块链在物流行业的应用
  18. JavaScript深入浅出(进阶)
  19. 敬畏传奇——直面第一台可编程电子计算机:Colossus
  20. Proxmark3的编译

热门文章

  1. Docker学习笔记2——Docker组件(幕布笔记)
  2. 递归算法与非递归算法比较
  3. 实验十三 团队作业9:BETA冲刺与团队项目验收
  4. MIT-Adobe FiveK Dataset 图片自动下载
  5. HTML基础知识整合复习总结
  6. pdf转换成excel转换器破解版下载
  7. CRUISE纯电动车双电机四驱仿真模型,基于simulink DLL联合仿真模型,实现前后电机效率最优及稳定性分配
  8. python显示日历_Python获取时间范围内日期列表和周列表的函数
  9. 将jar包导入本地仓库配置阿里仓库
  10. 应用监控以及告警实现