【问题标题】:Changing link colors for mobile menu only仅更改移动菜单的链接颜色
【发布时间】:2019-11-06 04:03:15
【问题描述】:

我有一个很好的响应式网站。但是,在桌面版上,我最近将上方导航栏中的链接颜色更改为白色,但在移动版中,当我点击汉堡菜单时,因为背景也是白色,所以全是白色。我看不到链接。如何为移动菜单的链接着色?

不确定需要什么代码,所以我先从这个开始:

<!--  navbar-inverse  navbar-fixed-top  -->
<nav class="navbar" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <!--  These create the 3 bars for the drop-down menu on mobile screen sizes  -->
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse navbar-ex1-collapse nav-change">
                <ul class="nav navbar-nav navbar-right">
                    <li><?php if ($thisPage=='analysis') { echo ''; } else { echo '<a href="/analysis/index.php">Analysis</a>'; }?></li>
                    <li><?php if ($thisPage=='weblog') { echo ''; } else { echo '<a href="/weblog/index.php">Blog</a>'; }?></li>
                    <li><?php if ($thisPage=='documents') { echo ''; } else { echo '<a href="/documents/index.php">Documents</a>'; }?></li>
                    <li><?php if ($thisPage=='media') { echo ''; } else { echo '<a href="/media/index.php">Media</a>'; }?></li>
                    <li><?php if ($thisPage=='books') { echo ''; } else { echo '<a href="/books.php">Books</a>'; }?></li>
                    <li><?php if ($thisPage=='gaza') { echo ''; } else { echo '<a href="/gaza-commentaries-booklets-pictures.php">Gaza</a>'; }?></li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Myths <b class="caret"></b></a>
                        <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                          <li><?php if ($thisPage=='myths') { echo ''; } else { echo '<a href="/palestinian-myths/index.php">\'Palestine\' & \'Palestinians\'</a>'; }?></li>
                        </ul>
                    </li>
                                        <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Links <b class="caret"></b></a>
                        <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">

                    <li><?php if ($thisPage=='supportIsrael') { echo ''; } else { echo '<a href="/links2.php">Support Israel Links</a>'; }?></li>
                    <li><?php if ($thisPage=='interest') { echo ''; } else { echo '<a href="/links.php">Links of Interest</a>'; }?></li>
                    <li><?php if ($thisPage=='newsMedia') { echo ''; } else { echo '<a href="/news-services.php">News Media Listing</a>'; }?></li>
                        </ul>
                    </li>
                    <li><?php if ($thisPage=='about') { echo ''; } else { echo '<a href="/about.php">About</a>'; }?></li>
                    <li><?php if ($thisPage=='home') {echo '';} else { echo '<a href="/index.php">Home</a>';}?></li>
                    <li><?php if ($thisPage=='contact') { echo ''; } else { echo '<a href="/contact.php">Contact</a>'; }?></li>
                    </li>

如果需要其他代码来解决此问题,请告诉我。

【问题讨论】:

    标签: hyperlink responsive-design hamburger-menu


    【解决方案1】:

    我想通了。

    @media (max-width: 767px) {
      .nav > li, .nav > li > a {
        color: #230cf2; !important
    }}
    

    【讨论】:

      猜你喜欢
      • 2013-06-23
      • 2020-05-17
      • 2018-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多