案例:携程网首页案例制作(曾经的版本)
更多福利模块制作
index.html
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>携程在手,收走就走title>
<meta name="viewport" content="width=device-width,user-scalable=no,
initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/index.css">
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-icon-icon1">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon2">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon3">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon4">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon5">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon6">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon7">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon8">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon9">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon10">span>
<span>wifi电话卡span>
a>
li>
ul>
<div class="sales-box">
<div class="sales-hd">
<h2>热门活动h2>
<a href="#" class="more">获取更多福利a>
div>
div>
body>
html>
index.css
body{
max-width: 540px;
min-width: 320px;
margin: 0 auto;
background-color: #f2f2f2;
font: normal 16px/1.5 PingFangSC-regular,Tahoma,Lucida Grande,Verdana,Microsoft Yahei,STXihei,hei;
color: #000;
overflow-x: hidden;
-webkit-tap-highlight-color: transparent;
font-size: 14px;
}
ul{
list-style: none;
padding: 0;
margin: 0;
}
a{
text-decoration: none;
color: #222;
}
div{
box-sizing: border-box;
}
.search-index{
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 100%;
max-width: 540px;
min-width: 320px;
height: 44px;
background: linear-gradient(to right,#2fa2ff,#2285fa);
display: flex;
}
.search{
flex: 1;
height: 26px;
background-color: #fff;
margin: 7px 10px;
border-radius: 15px;
position: relative;
font-size: 12px;
line-height: 26px;
padding-left: 10px;
color: #666;
}
.search::after{
position: absolute;
top: 1px;
right: 1px;
content: "搜索";
width: 45px;
height: 24px;
font-size: 12px;
border-radius: 15px;
background: linear-gradient(to right,#33c6fc,#3fabff);
text-align: center;
line-height: 24px;
color: #fff;
}
.user{
width: 50px;
height: 44px;
font-size: 12px;
color: #fff;
text-align: center;
}
.user::before{
content: "";
display: block;
width: 24px;
height: 24px;
background: url(../images/map.png) no-repeat;
background-size: 24px;
margin: 0 auto;
}
.focus{
margin: 50px 10px 0;
}
.focus img{
width: 100%;
border-radius: 10px;
}
.local-nav{
height: 64px;
margin: 3px 4px;
background-color: #fff;
border-radius: 8px;
display: flex;
}
.local-nav li{
flex: 1;
}
.local-nav a{
display: flex;
flex-direction: column;
align-items: center;
}
.local-nav li [class^="local-nav-icon"]{
margin-top: 8px;
width: 32px;
height: 32px;
background: url(../images/localnav_bg.png) no-repeat 0 0;
background-size: 32px auto;
}
.local-nav li .local-nav-icon-icon2{
background-position: 0 -32px;
}
.local-nav li .local-nav-icon-icon3{
background-position: 0 -64px;
}
.local-nav li .local-nav-icon-icon4{
background-position: 0 -96px;
}
.local-nav li .local-nav-icon-icon5{
background-position: 0 -128px;
}
nav{
overflow:hidden;
border-radius: 8px;
margin: 0 4px 3px;
}
.nav-common{
height: 88px;
background-color: pink;
display: flex;
}
.nav-common:nth-child(2){
margin: 3px 0;
}
.nav-items{
flex: 1;
display: flex;
flex-direction: column;
}
.nav-items:nth-child(-n+2){
border-right: 1px solid #fff;
}
.nav-items a{
flex: 1;
line-height: 44px;
text-align: center;
color: #ffff;
text-shadow: 1px 1px rgba(0,0,0,0.2);
}
.nav-items a:nth-child(1){
border-bottom: 1px solid #fff;
}
.nav-items:nth-child(1) a{
border-bottom: 0;
background: url(../images/hotel.png) no-repeat bottom center;
background-size: 121px auto;
}
.nav-common:nth-child(1){
background: -webkit-linear-gradient(left,#fa5a55,#fa994d);
}
.nav-common:nth-child(2){
background: -webkit-linear-gradient(left,#4b90ed,#53bced);
}
.nav-common:nth-child(3){
background: -webkit-linear-gradient(left,#34c2a9,#6cd559);
}
.subnav-entry{
border-radius: 8px;
background-color: #fff;
margin: 0 4px;
display: flex;
flex-wrap: wrap;
padding: 5px 0;
}
.subnav-entry li{
flex: 20%;
}
.subnav-entry a{
display: flex;
flex-direction: column;
align-items: center;
}
.subnav-entry li [class^="subnav-entry-icon"]{
margin-top: 4px;
width: 28px;
height: 28px;
background: url("../images/subnav-bg.png") no-repeat 0 0;
background-size: 28px auto;
}
.subnav-entry li .subnav-entry-icon-icon2{
background-position: 0 -30px;
}
.subnav-entry li .subnav-entry-icon-icon3{
background-position: 0 -65px;
}
.subnav-entry li .subnav-entry-icon-icon4{
background-position: 0 -322px;
}
.subnav-entry li .subnav-entry-icon-icon5{
background-position: 0 -100px;
}
.subnav-entry li .subnav-entry-icon-icon6{
background-position: 5px -160px;
}
.subnav-entry li .subnav-entry-icon-icon7{
background-position: 0 -195px;
}
.subnav-entry li .subnav-entry-icon-icon8{
background-position: 0 -130px;
}
.subnav-entry li .subnav-entry-icon-icon9{
background-position: 0 -230px;
}
.subnav-entry li .subnav-entry-icon-icon10{
background-position: 5px -288px;
}
.sales-box{
border-top: 1px solid #bbb;
background-color: #fff;
margin: 4px;
}
.sales-hd{
position: relative;
height: 44px;
border-bottom:1px solid #ccc
}
.sales-hd h2{
text-indent: -999px;
overflow: hidden;
position: relative;
}
.sales-hd h2::after{
content: "";
position: absolute;
top: 8px;
left: 20px;
width: 79px;
height: 15px;
background: url(../images/hot.png) no-repeat 0 -20px;
background-size: 79px auto;
}
.more{
position: absolute;
right: 5px;
top: 0;
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);
}
内容模块制作
index.html
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>携程在手,收走就走title>
<meta name="viewport" content="width=device-width,user-scalable=no,
initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/index.css">
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-icon-icon1">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon2">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon3">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon4">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon5">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon6">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon7">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon8">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon9">span>
<span>wifi电话卡span>
a>
li>
<li>
<a href="#">
<span class="subnav-entry-icon-icon10">span>
<span>wifi电话卡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="#" id="">
<img src="./upload/pic1.jpg" alt="">
a>
<a href="#" id="">
<img src="./upload/pic2.jpg" alt="">
a>
div>
<div class="row">
<a href="#" id="">
<img src="./upload/pic3.jpg" alt="">
a>
<a href="#" id="">
<img src="./upload/pic4.jpg" alt="">
a>
div>
<div class="row">
<a href="#" id="">
<img src="./upload/pic5.jpg" alt="">
a>
<a href="#" id="">
<img src="./upload/pic6.jpg" alt="">
a>
div>
div>
div>
body>
html>
index.css
body{
max-width: 540px;
min-width: 320px;
margin: 0 auto;
background-color: #f2f2f2;
font: normal 16px/1.5 PingFangSC-regular,Tahoma,Lucida Grande,Verdana,Microsoft Yahei,STXihei,hei;
color: #000;
overflow-x: hidden;
-webkit-tap-highlight-color: transparent;
font-size: 14px;
}
ul{
list-style: none;
padding: 0;
margin: 0;
}
a{
text-decoration: none;
color: #222;
}
div{
box-sizing: border-box;
}
.search-index{
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 100%;
max-width: 540px;
min-width: 320px;
height: 44px;
background: linear-gradient(to right,#2fa2ff,#2285fa);
display: flex;
}
.search{
flex: 1;
height: 26px;
background-color: #fff;
margin: 7px 10px;
border-radius: 15px;
position: relative;
font-size: 12px;
line-height: 26px;
padding-left: 10px;
color: #666;
}
.search::after{
position: absolute;
top: 1px;
right: 1px;
content: "搜索";
width: 45px;
height: 24px;
font-size: 12px;
border-radius: 15px;
background: linear-gradient(to right,#33c6fc,#3fabff);
text-align: center;
line-height: 24px;
color: #fff;
}
.user{
width: 50px;
height: 44px;
font-size: 12px;
color: #fff;
text-align: center;
}
.user::before{
content: "";
display: block;
width: 24px;
height: 24px;
background: url(../images/map.png) no-repeat;
background-size: 24px;
margin: 0 auto;
}
.focus{
margin: 50px 10px 0;
}
.focus img{
width: 100%;
border-radius: 10px;
}
.local-nav{
height: 64px;
margin: 3px 4px;
background-color: #fff;
border-radius: 8px;
display: flex;
}
.local-nav li{
flex: 1;
}
.local-nav a{
display: flex;
flex-direction: column;
align-items: center;
}
.local-nav li [class^="local-nav-icon"]{
margin-top: 8px;
width: 32px;
height: 32px;
background: url(../images/localnav_bg.png) no-repeat 0 0;
background-size: 32px auto;
}
.local-nav li .local-nav-icon-icon2{
background-position: 0 -32px;
}
.local-nav li .local-nav-icon-icon3{
background-position: 0 -64px;
}
.local-nav li .local-nav-icon-icon4{
background-position: 0 -96px;
}
.local-nav li .local-nav-icon-icon5{
background-position: 0 -128px;
}
nav{
overflow:hidden;
border-radius: 8px;
margin: 0 4px 3px;
}
.nav-common{
height: 88px;
background-color: pink;
display: flex;
}
.nav-common:nth-child(2){
margin: 3px 0;
}
.nav-items{
flex: 1;
display: flex;
flex-direction: column;
}
.nav-items:nth-child(-n+2){
border-right: 1px solid #fff;
}
.nav-items a{
flex: 1;
line-height: 44px;
text-align: center;
color: #ffff;
text-shadow: 1px 1px rgba(0,0,0,0.2);
}
.nav-items a:nth-child(1){
border-bottom: 1px solid #fff;
}
.nav-items:nth-child(1) a{
border-bottom: 0;
background: url(../images/hotel.png) no-repeat bottom center;
background-size: 121px auto;
}
.nav-common:nth-child(1){
background: -webkit-linear-gradient(left,#fa5a55,#fa994d);
}
.nav-common:nth-child(2){
background: -webkit-linear-gradient(left,#4b90ed,#53bced);
}
.nav-common:nth-child(3){
background: -webkit-linear-gradient(left,#34c2a9,#6cd559);
}
.subnav-entry{
border-radius: 8px;
background-color: #fff;
margin: 0 4px;
display: flex;
flex-wrap: wrap;
padding: 5px 0;
}
.subnav-entry li{
flex: 20%;
}
.subnav-entry a{
display: flex;
flex-direction: column;
align-items: center;
}
.subnav-entry li [class^="subnav-entry-icon"]{
margin-top: 4px;
width: 28px;
height: 28px;
background: url("../images/subnav-bg.png") no-repeat 0 0;
background-size: 28px auto;
}
.subnav-entry li .subnav-entry-icon-icon2{
background-position: 0 -30px;
}
.subnav-entry li .subnav-entry-icon-icon3{
background-position: 0 -65px;
}
.subnav-entry li .subnav-entry-icon-icon4{
background-position: 0 -322px;
}
.subnav-entry li .subnav-entry-icon-icon5{
background-position: 0 -100px;
}
.subnav-entry li .subnav-entry-icon-icon6{
background-position: 5px -160px;
}
.subnav-entry li .subnav-entry-icon-icon7{
background-position: 0 -195px;
}
.subnav-entry li .subnav-entry-icon-icon8{
background-position: 0 -130px;
}
.subnav-entry li .subnav-entry-icon-icon9{
background-position: 0 -230px;
}
.subnav-entry li .subnav-entry-icon-icon10{
background-position: 5px -288px;
}
.sales-box{
border-top: 1px solid #bbb;
background-color: #fff;
margin: 4px;
}
.sales-hd{
position: relative;
height: 44px;
border-bottom:1px solid #ccc
}
.sales-hd h2{
text-indent: -999px;
overflow: hidden;
position: relative;
}
.sales-hd h2::after{
content: "";
position: absolute;
top: 8px;
left: 20px;
width: 79px;
height: 15px;
background: url(../images/hot.png) no-repeat 0 -20px;
background-size: 79px auto;
}
.more{
position: absolute;
right: 5px;
top: 0;
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;
border-bottom: 1px solid #eee;
}
.row a{
flex: 1;
}
.row a img{
width: 100%;
}
.row a:nth-child(1){
border-right: 1px solid #eee;
}