【问题标题】:Navigation icon not showing up on mobile version?导航图标在移动版上不显示?
【发布时间】:2015-06-08 05:35:30
【问题描述】:

所以我修改了 css 元素以添加 background image 但到目前为止,在移动设备上显示导航图标没有任何成功。请帮助我在 Link 的响应式设计视图中调试代码,并告诉我什么有效。感谢您的时间。下面的常规 css

#menu-icon {
    display: none;
    background-image: url(http://www.w3newbie.com/wp-content/uploads/icon.png) center;
    width: 40px;
    height: 40px;
    background-image: no-repeat;
}

下面的移动CSS

#menu-icon{
    display: block;
}

【问题讨论】:

    标签: html css mobile navigation


    【解决方案1】:

    background-image 没有位置center 等多个属性。它应该是background。同样对于重复语法应该是background-repeat。如下所示更新您的 CSS。

      #menu-icon {
        display: none;
        background: url(http://www.w3newbie.com/wp-content/uploads/icon.png) center;
        width: 40px;
        height: 40px;
        background-repeat: no-repeat;
      }
    

    或者你可以像下面这样使用它。

      #menu-icon {
        display: none;
        background-image: url(http://www.w3newbie.com/wp-content/uploads/icon.png);
        background-position:center;
        width: 40px;
        height: 40px;
        background-repeat: no-repeat;
      }
    

    您的移动 CSS 没有问题。

    【讨论】:

      猜你喜欢
      • 2018-05-11
      • 2020-11-28
      • 1970-01-01
      • 2021-04-11
      • 1970-01-01
      • 1970-01-01
      • 2022-01-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多