• 移动端布局之flex布局3:案例-携程网首页案例制作(曾经的版本)2


    案例:携程网首页案例制作(曾经的版本)

    背景线性渐变

    background:linear-gradient(起始方向,颜色1,颜色2,…);
    background: -webkit-linear-gradient(left,red,blue);
    background: -webkit-linear-gradient(left top,red,blue);

    背景渐变必须添加浏览器私有前缀
    起始方向可以是:方位名词 或者度数,如果省略就是top

    DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Titletitle>
        <style>
            div{
                width: 800px;
                height: 200px;
                /*背景渐变必须添加浏览器私有前缀*/
                background: -webkit-linear-gradient(left,red,blue);
            }
        style>
    head>
    <body>
    <div>div>
    body>
    html>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

    在这里插入图片描述

    DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Titletitle>
        <style>
            div{
                width: 800px;
                height: 200px;
                /*背景渐变必须添加浏览器私有前缀*/
                /*background: -webkit-linear-gradient(left,red,blue);*/
                background: -webkit-linear-gradient(45deg,red,blue);
            }
        style>
    head>
    <body>
    <div>div>
    body>
    html>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    在这里插入图片描述

    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>
    body>
    html>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98

    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;
        /*ul有默认的padding和margin值*/
        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;
        /*background-color: mediumpurple;*/
    }
    .user::before{
        content: "";
        display: block;
        width: 24px;
        height: 24px;
        background: url(../images/map.png) no-repeat;
        background-size: 24px;
        margin: 0 auto;
    }
    /*focus*/
    .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*/
    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容器*/
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    /*-n+2就是选择前两个,n+2是从第二个开始*/
    .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);
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178

    在这里插入图片描述

    侧导航栏

    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>
    body>
    html>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161

    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;
        /*ul有默认的padding和margin值*/
        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;
        /*background-color: mediumpurple;*/
    }
    .user::before{
        content: "";
        display: block;
        width: 24px;
        height: 24px;
        background: url(../images/map.png) no-repeat;
        background-size: 24px;
        margin: 0 auto;
    }
    /*focus*/
    .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*/
    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容器*/
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    /*-n+2就是选择前两个,n+2是从第二个开始*/
    .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;
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231

    在这里插入图片描述

    热门活动模块制作

    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="#">更多a>
            div>
        div>
    body>
    html>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168

    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;
        /*ul有默认的padding和margin值*/
        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;
        /*background-color: mediumpurple;*/
    }
    .user::before{
        content: "";
        display: block;
        width: 24px;
        height: 24px;
        background: url(../images/map.png) no-repeat;
        background-size: 24px;
        margin: 0 auto;
    }
    /*focus*/
    .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*/
    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容器*/
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    /*-n+2就是选择前两个,n+2是从第二个开始*/
    .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*/
    .sales-box{
        border-top: 1px solid #bbb;
        background-color: #fff;
        margin: 4px;
    }
    .sales-hd{
        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;
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257

    在这里插入图片描述

  • 相关阅读:
    基于yolov5s+bifpn实践隧道裂缝裂痕检测
    Map接口
    linux 搭建mycat
    git操作将本地的代码推送到远程仓库
    知识图谱补全(KGC)论文阅读笔记
    执行Django 的迁移命令报错[1193, Unknown system variable default_storage_engine]
    【Linux升级之路】0_Linux入门 | 环境搭建 | 使用常识 | 用户管理
    【docker-compose 跨节点部署 kafka-kraft SASL用户加密集群】全网最新!
    R - 非线性最小二乘
    LeetCode710. 黑名单中的随机数.Random Pick with Blacklist [hash映射][前缀和][二分]
  • 原文地址:https://blog.csdn.net/qq_34306228/article/details/131084932