Adjust text color in submenu

Asked

Viewed 457 times

5

I took over a site to continue the development, but I have a legacy problem, I’m not able to leave the text black when the user hovers over a menu option. For example, when hovering over the CATEGORIES option the submenu options should turn black.

The CSS is like this:

#bt-menu, #bt-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
#bt-menu {
    width: 1176px;
    margin: 0px auto;
    background: #102983;
}
#bt-menu:before, #bt-menu:after {
    content: "";
    display: table;
}
#bt-menu:after {
    clear: both;
}
#bt-menu {
    zoom: 1;
}
#bt-menu li {
    float: left;
    position: relative;
    color: #000;
}
/* OPÇÕES DO MENU - AQUI QUANDO ALTERO 000 O TEXTO FICA EM PRETO */
#bt-menu a {
    float: left;
    padding: 12px 30px;
    color: #FFF;
    text-transform: uppercase;
    font:12px Arial, Helvetica;
    text-decoration: none;
}
/* COR DO TEXTO DO MENU */
#bt-menu li:hover > a {
    background: #FFEC01;
    color: #000;
}
*html #bt-menu li a:hover { /* IE6 only */
    color: #000;
}
#bt-menu ul {
    margin: 20px 0 0 0;
    _margin: 0; /*IE6 only*/
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 39px;
    left: 0;
    z-index: 9999;
    background: #FFEC01;

}
#bt-menu li:hover > ul {
    opacity: 1;
    visibility: visible;
    margin: 0;
}
#bt-menu ul ul {
    top: 0;
    left: 150px;
    margin: 0 0 0 0px;
    _margin: 0; /*IE6 only*/
}
#bt-menu ul li {
    float: none;
    display: block;
    border: 0;
    _line-height: 0; /*IE6 only*/
}
#bt-menu ul li:last-child {
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}
#bt-menu ul a {
    padding: 10px;
    width: 190px;
    _height: 10px; /*IE6 only*/
    display: block;
    white-space: nowrap;
    float: none;
    text-transform: none;
}
#bt-menu ul a:hover {
    background-color: #FFEC01;
}

#bt-menu ul li:first-child > a:after {
    content: '';
    position: absolute;
    left: 40px;
    top: -6px;

}
#bt-menu ul ul li:first-child a:after {
    left: -6px;
    top: 50%;
    margin-top: -6px;
}

An example can be seen here:

Position the pointer over CATEGORY

2 answers

2

If you want to leave black, just add the color tag: #000; no #bt-menu ul a .

  #bt-menu ul a {
      padding: 10px;
      width: 190px;
      _height: 10px;
      /*IE6 only*/
      display: block;
      white-space: nowrap;
      float: none;
      text-transform: none;
      color:#000;
    }

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>AABB - Associação Atlética Banco do Brasil</title>
  <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="css/stylesGaleria.css" type="text/css" />
  <link rel="stylesheet" type="text/css" media="screen" href="screen.css" />
  <link href="css/principal.css" rel="stylesheet" type="text/css" />


  <style>
    #bt-menu,
    #bt-menu ul {
      margin: 0;
      padding: 0;
      list-style: none;
    }
    #bt-menu {
      width: 1176px;
      margin: 0px auto;
      background: #102983;
    }
    #bt-menu:before,
    #bt-menu:after {
      content: "";
      display: table;
    }
    #bt-menu:after {
      clear: both;
    }
    #bt-menu {
      zoom: 1;
    }
    #bt-menu li {
      float: left;
      position: relative;
      color: #000;
    }
    /* OPÇÕES DO MENU */
    #bt-menu a {
      float: left;
      padding: 12px 30px;
      color: #FFF;
      text-transform: uppercase;
      font: 12px Arial, Helvetica;
      text-decoration: none;
    }
    /* COR DO TEXTO DO MENU */
    #bt-menu li:hover > a {
      background: #FFEC01;
      color: #000;
    }
    *html #bt-menu li a:hover {
      /* IE6 only */
      color: #000;
    }
    #bt-menu ul {
      margin: 20px 0 0 0;
      _margin: 0;
      /*IE6 only*/
      opacity: 0;
      visibility: hidden;
      position: absolute;
      top: 39px;
      left: 0;
      z-index: 9999;
      background: #FFEC01;
    }
    #bt-menu li:hover > ul {
      opacity: 1;
      visibility: visible;
      margin: 0;
    }
    #bt-menu ul ul {
      top: 0;
      left: 150px;
      margin: 0 0 0 0px;
      _margin: 0;
      /*IE6 only*/
    }
    #bt-menu ul li {
      float: none;
      display: block;
      border: 0;
      _line-height: 0;
      /*IE6 only*/
    }
    #bt-menu ul li:last-child {
      -moz-box-shadow: none;
      -webkit-box-shadow: none;
      box-shadow: none;
    }
    #bt-menu ul a {
      padding: 10px;
      width: 190px;
      _height: 10px;
      /*IE6 only*/
      display: block;
      white-space: nowrap;
      float: none;
      text-transform: none;
      color:#000;
    }
    #bt-menu ul a:hover {
      background-color: #FFEC01;
    }
    #bt-menu ul li:first-child > a:after {
      content: '';
      position: absolute;
      left: 40px;
      top: -6px;
    }
    #bt-menu ul ul li:first-child a:after {
      left: -6px;
      top: 50%;
      margin-top: -6px;
    }
  </style>

</head>

<body>
  <section class="ad_container clearfix">
    <script type="text/javascript">
      (function() {
        var bsa = document.createElement('script');
        bsa.type = 'text/javascript';
        bsa.async = true;
        bsa.src = 'http://s3.buysellads.com/ac/bsa.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(bsa);
      })();
    </script>

  </section>
  <div class="container">
    <!-- Início Cabeçalho !-->
    <div class="cabecalho">

      <a href="www.globo.com">
        <div class="facebook"></div>
      </a>

    </div>

    <!-- Fim Cabeçalho !-->
    <div id="menu">
      <ul id="bt-menu">
        <li><a href="#">QUEM SOMOS</a>
        </li>
        <li> <a href="#">NOTÍCIAS</a>
        </li>
        <li><a href="#">TÍTULOS</a>
        </li>
        <li><a href="#">CATEGORIAS</a>
          <ul>
            <li><a href="#">Sub 05</a>
            </li>
            <li><a href="#">Sub 07</a>
            </li>
            <li><a href="#">Sub 09</a>
            </li>
            <li><a href="#">Sub 11</a>
            </li>
            <li><a href="#">Sub 13</a>
            </li>
            <li><a href="#">Sub 15</a>
            </li>
            <li><a href="#">Sub 17</a>
            </li>
          </ul>
        </li>
        <li><a href="#">CAMPEONATOS</a>
        </li>
        <li><a href="#">FOTOS E VÍDEOS</a>
        </li>
        <li><a href="#">LINK</a>
        </li>
        <li><a href="#">LOJA</a>
        </li>
        <li><a href="#">FALE CONOSCO</a>
        </li>
      </ul>
    </div>
    <div id="banner"></div>
    <div id="imgCentro"></div>
    <div id="separador"></div>
    <!-- Início Conteúdo !-->
    <!-- Fim Conteúdo !-->
    <!-- Início do Rodapé !-->
    <div class="rodapeEndereco"></div>
    <!-- Fim do Rodape !-->
  </div>
</body>

</html>

  • Hello @Renilsonandrade, I need the text to be black not the background, thanks for the tip.

  • @adventistapr edited the answer, see if this is what you need.

  • Hello @Renilsonandrade, that’s right, thanks for the help.

2


Puts a color: black here:

#bt-menu ul a

Browser other questions tagged

You are not signed in. Login or sign up in order to post.