前端小tips:京东灰色上端导航条

前端小tips:京东灰色上端导航条
跟着视频做练习,发现还是有一些指向问题不太清楚。后来有一个细节上,出现错误,显示效果一直不太理想。后来重新跟着视频代码对拍,发现了错误。

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <title>京东导航条</title>

    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./fontawesome/css/all.css">

    <style>
        .clearfix::before,
        .clearfix::after {
            content: '';
            display: table;
            clear: both;
        }

        body {
            /* 设置字体 */
            font: 12px/1.5 Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif;
            color: #ddd;
        }

        /* 设置外部容器的样式 */
        .top-bar-wrapper {
            width: 100%;
            height: 30px;
            background: #e3e4e5;
            line-height: 30px;
            border-bottom: 1px #ddd solid
        }

        /* 设置内部容器样式 */
        .top-bar {
            width: 1190px;
            margin: 0 auto;
            position: relative;
        }

        /* 设置字体样式 */
        .top-bar a,
        .top-bar span,
        .top-bar i {
            color: #999;
            text-decoration: none;
        }

        .top-bar i {
            margin: 0 0 0 2px;
        }

        .top-bar a:hover,
        .top-bar a.highlight {
            color: rgb(226, 17, 17);
        }

        .location {
            float: left;
        }

        /* 设置下拉城市列表的效果 */
        .location .city-list {
            display: none;
            width: 320px;
            height: 436px;
            background-color: white;
            border: 1px solid rgb(204, 204, 204);
            /* 设置绝对定位,使其不占据位置 */
            position: absolute;
            top: 31px;
            box-shadow: 0 2px 2px rgba(0, 0, 0, .2);
        }

        /* 设置current-city移入效果*/
        .current-city {
            padding: 0 10px;

            border: 1px solid transparent;
            border-bottom: none;
            position: relative;

            z-index: 1;
        }

        .location:hover .current-city {
            background-color: white;
            border: 1px solid rgb(204, 204, 204);
            border-bottom: none;
            padding-bottom: 1px;
        }

        .location .fas {
            font-size: 14px;
            color: red;
        }

        .location:hover .city-list {
            display: block;
        }

        /* 设置分割线 */
        .shortcut .line {
            width: 1px;
            height: 10px;
            background-color: #999;
            margin: 12px 12px 0;
        }

        .shortcut {
            float: right;
        }

        /* 设置li */
        .shortcut li {
            float: left;
        }
    </style>
</head>

<body>
    <div class="top-bar-wrapper">
        <div class="top-bar clearfix">

            <div class="location">
                <div class="current-city">
                    <i class="fas fa-map-marker-alt"></i>
                    <a href="javascript:;">北京</a>
                </div>

                <div class="city-list">

                </div>
            </div>

            <ul class="shortcut clearfix">
                <li>
                    <a href="javascript:;">你好,请登录</a>
                    <a class="highlight" href="javascript:;">免费注册</a>
                </li>
                <li class="line"></li>
                <li>
                    <a href="javascript:;">我的订单</a>
                </li>
                <li class="line"></li>
                <li>
                    <a href="javascript:;">我的京东</a>
                    <i class="fas fa-angle-down"></i>
                </li>
                <li class="line"></li>
                <li>
                    <a href="javascript:;">京东会员</a>
                </li>
                <li class="line"></li>
                <li>
                    <a class="highlight" href="javascript:;">企业采购</a>
                    <i class="fas fa-angle-down"></i>
                </li>


                <li class="line"></li>
                <li>
                    <span>客户服务</span>
                    <i class="fas fa-angle-down"></i>
                </li>

                <li class="line"></li>
                <li>
                    <span>网站导航</span>
                    <i class="fas fa-angle-down"></i>
                </li>
                <li class="line"></li>
                <li>
                    <span>手机京东</span>
                </li>

            </ul>
        </div>
    </div>
</body>

</html>
上一篇:echarts柱状图多柱重叠和多柱堆叠


下一篇:关于样本方差的无偏估计