简体   繁体   English

菜单图标未显示在手机上

[英]Menu Icon not showing on mobile

I am trying to get my menu icon to show next to my logo at the top right of the navigation bar, but it's not showing on mobile. 我正在尝试让菜单图标显示在导航栏右上角的徽标旁边,但是它没有在手机上显示。 Any help is appreciated, I really don't know where to start, I've tried to tweak with the margins but no luck. 感谢您提供任何帮助,我真的不知道从哪里开始,我试图调整利润率,但是没有运气。

CSS: CSS:

@media only screen and (max-width: 321px) {
    body {
        line-height: 1.25em;
        font-family: 'Questrial', sans-serif;
        color: #505050;
        margin: 0;
        padding: 0;
    }

    header {
        background: #505050;
        width: 100%;
        height: 80px;
        position: fixed;
        top: 0;
        left: 0;
        border-bottom: 1px solid #fff;
        z-index: 100;
        padding-bottom: 10px;
        margin-bottom: 5px;
    }

    #menu-icon {
        width: 15px;
        height: 15px;
        background: #fff url(img/menu-icon.png) center;
        position: relative;
    }

    #logo {
        margin-top: 10px;
        margin-left: 10px;
        float: left;
        width: 170px;
        height: 70px;
        display: block;
    }

    nav {
        float: right;
        padding-right: 300px;
        color: #fff;
        margin-top: 25px;
    }

    nav .active {
        font-size: 20px;
        color: #cc293f;
        font-weight: bold;
    }

    nav a {
        margin-right: 20px;
        font-size: 20px;
        color: #fff;
        text-decoration: none;
        font-weight: bold;
    }

    a:hover {
        color: #cc293f
    }

    a:hover#menu-icon {
        background-color: #fff;
        border-radius: 4px 4px 0 0;
    }

    ul {
        list-style: none
    }

    li {
        color: #fff;
        display: inline-block;
        float: left;
    }
}

HTML: HTML:

<header>
    <img id="logo" src="img/logo.png">
    <nav>
        <a href="#" id="menu-icon"></a>
        <ul>
            <li><a class="active" href="index.html">HOME</a></li>
            <li><a class="nav" href="upload.html">UPLOAD</a></li>
            <li><a class="nav" href="support.html">SUPPORT</a></li>
            <li><a class="nav" href="faqs.html">FAQS</a> </li>
        </ul>
    </nav>
</header>

The a#menu-icon is retaining a display property of inline . a#menu-icon保留inline的显示属性。 Thus, the width and height properties you're setting have no effect. 因此,您设置的width和height属性无效。 Try adding display: inline-block . 尝试添加display: inline-block

I added the following code from an old version of the website, here is the code: 我从旧版本的网站添加了以下代码,这是代码:

#menu-icon {    display: inline-block }
nav ul, nav:active ul {
    display: none;
    position: absolute;
    padding: 10px;
    background: #505050;
    border: 5px solid #fff;
    right: 20px;
    top: 60px;
    width: 50%;
    border-radius: 4px 0 4px 4px;
}
nav li {
    font-color: #fff;
    text-align: center;
    width: 100%;
    padding: 10px 0;
    margin: 0;
}
nav:hover ul {
    background-color: #505050;
    display: block;
}
nav ul {    background: #505050 }

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM