ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

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

2021-09-15 14:02:10  阅读:231  来源: 互联网

标签:bar 204 color top 1px 导航条 tips border 京东


效果图
跟着视频做练习,发现还是有一些指向问题不太清楚。后来有一个细节上,出现错误,显示效果一直不太理想。后来重新跟着视频代码对拍,发现了错误。

<!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>

标签:bar,204,color,top,1px,导航条,tips,border,京东
来源: https://blog.csdn.net/weixin_48451943/article/details/120306860

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有