image.png
    image.png
    32实战项目1 - 图3

    1. <!DOCTYPE html>
    2. <html>
    3. <head>
    4. <meta charset="UTF-8">
    5. <title></title>
    6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    7. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
    8. integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    9. <link rel="stylesheet" href="css/iconfont.css">
    10. <link rel="stylesheet" href="css/index.css">
    11. </head>
    12. <body>
    13. <div class="container-fluid"><!-- 栅格系统:不管屏幕大小都是100% -->
    14. <div class="row justify-content-end">
    15. <!-- 左边内容 -->
    16. <div class="col-lg-4 position-fixed border-right leftCon"><!-- 1、解决左边内容在右边的问题 -->
    17. <!-- 导航栏 -->
    18. <header class="navbar d-none d-sm-flex px-0 px-lg-3 py-3 py-lg-4">
    19. <a href="#" class="navbar-brand"><img src="images/logo.svg" alt="" width="36"></a>
    20. <ul class="nav mr-auto"> <!--mr-auto: 图标和文字挨着 -->
    21. <li class="nav-item">
    22. <a href="#" class="nav-link text-dark font-weight-bold">门店</a>
    23. </li>
    24. <li class="nav-item">
    25. <a href="#" class="nav-link text-dark font-weight-bold">我的账户</a>
    26. </li>
    27. <li class="nav-item">
    28. <a href="#" class="nav-link text-dark font-weight-bold">菜单</a>
    29. </li>
    30. </ul>
    31. <span class="iconfont icon-menu" id="showBtn"></span><!-- 三条杠iconfont -->
    32. </header>
    33. <!-- 标题与登录注册 -->
    34. <div class="d-flex align-items-center login">
    35. <div class="px-0 px-lg-5">
    36. <h1 class="font-weight-bold py-3">心情惬意,来杯咖啡吧 <span class="iconfont icon-kafei"></span></h1>
    37. <div class="d-none d-sm-block my-3">
    38. <a href="#" class="text-success">
    39. <span class="iconfont icon-denglu"></span>
    40. <span>登录</span>
    41. </a>
    42. <a href="#" class="btn btn-outline-success ml-4 register">注册</a>
    43. </div>
    44. </div>
    45. </div>
    46. <!-- 点击菜单后要展示的内容 -->
    47. <div class="d-flex bg-white flex-column justify-content-between position-absolute menu hide">
    48. <!-- 注意:flex-column:旋转后是垂直,但是其实本质上还是要横着,所以要justify-content-between-->
    49. <header class="navbar d-flex px-0 px-lg-3 py-3 py-lg-4">
    50. <a href="#" class="navbar-brand"><img src="images/logo.svg" alt="" width="36"></a>
    51. <span class="iconfont icon-guanbi" id="closeBtn"></span>
    52. </header>
    53. <div class="list">
    54. <ul class="list-unstyled mx-sm-5 pl-sm-5">
    55. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">门店</a></li>
    56. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">星享俱乐部</a></li>
    57. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">菜单</a></li>
    58. <hr>
    59. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">星巴克移动应用</a></li>
    60. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">星礼卡</a></li>
    61. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">星巴克臻选™</a></li>
    62. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">啡快™ - 在线点 到店取</a></li>
    63. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">专星送™</a></li>
    64. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">咖啡星讲堂</a></li>
    65. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">上海烘焙工坊</a></li>
    66. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">关于星巴克</a></li>
    67. <li><a href="#" class="font-weight-bold text-dark py-2 d-block">帮助中心</a></li>
    68. <hr>
    69. </ul>
    70. <div class="my-3 mx-sm-5 pl-sm-5 font">
    71. <a href="#" class="text-success">
    72. <span class="iconfont icon-denglu"></span>
    73. <span>登录</span>
    74. </a>
    75. <a href="#" class="btn btn-outline-success ml-4 register">注册</a>
    76. </div>
    77. </div>
    78. <footer class="mx-sm-5 pl-sm-5 pb-5">
    79. <div>
    80. <a href="#">English</a> | <a href="#">隐私政策</a> | <a href="#">使用条款</a> |
    81. </div>
    82. <div>
    83. <a href="#"><img src="images/icpicon.png" width="10" height="10" alt="">沪公网安备 31010402000318号</a> | <a href="#">沪ICP备17003747号</a>
    84. </div>
    85. </footer>
    86. </div>
    87. </div>
    88. <!-- 右边内容 -->
    89. <div class="col-lg-8">
    90. 右侧内容模压知道发生的发生sdgsdfgsdf
    91. </div>
    92. </div>
    93. </div>
    94. <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
    95. integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
    96. crossorigin="anonymous"></script>
    97. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
    98. integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
    99. crossorigin="anonymous"></script>
    100. <script>
    101. $('#showBtn').on('click',function(){
    102. $('.menu').removeClass('hide').addClass('show');
    103. });
    104. $('#closeBtn').on('click',function(){
    105. $('.menu').removeClass('show').addClass('hide');
    106. });
    107. </script>
    108. </body>
    109. </html>
    html {
        font-size: 62.5% !important;    /* 取默认字体的百分比 */
    }
    @media (min-width: 992px){
        html {
            font-size: 62.5%;
        }
    }
    @media (min-width: 768px){
        html {
            font-size: 59%;
        }
    }
    @media (min-width: 576px){
        html {
            font-size: 56%
        }
    }
    body{
        overflow-x: hidden;
    }
    a:hover{
        text-decoration: none;
    }
    
    /* 左侧内容 */
    .leftCon{
        left: 0;  /* 解决了左边内容靠右的问题 */
    }
    .leftCon header{
        height: 80px;
    }
    .leftCon header ul a{
        font-size: 1.6rem;
    }
    .leftCon .icon-menu{
        font-size: 3rem;
        cursor: pointer;
        color: #858585;
    }
    
    .login{
        height: calc(100vh - 80px);/* 减去的时导航栏的高度 */
    }
    .login .icon-kafei{
        font-size: 24px;
        color: #67a4c7;
    }
    .login a{
        font-size: 1.6rem;
    }
    .register{
        border-radius: 13px;
    }
    @media (max-width:991.98px){/* 媒体查询:解决左边在上,右边内容在下的问题 */
        .leftCon{
            position: relative!important;
        }
        .login{
            height: auto;
            /* 可以让login部分在小屏幕上调 */
        }
    }
    
    .menu{
        left: 0;
        top: 0;
        width:100%;
        height: 100vh;
        padding-left: 15px;
        padding-right: 15px;
    
        z-index: 2000;
        transition: 0.3s;
    }
    
    /* 切换隐藏显示状态 */
    .menu.hide{
        opacity: 0;
        transform: scale(2);/* 放大特效 */
        z-index: -1;
    }
    .menu.show{
        opacity: 1;
        transform: scale(1);
    }
    
    .menu .list ul a{
        font-size: 1.8rem;
    }
    .menu .font,.menu .font .btn{
        font-size: 1.6rem;
    }
    .menu footer{
        font-size: 1.4rem;
    }
    .menu footer,.menu footer a{
        color: rgba(0,0,0,0.38);
    }
    #closeBtn{
        cursor: pointer;
    }