0

I am new to coding. I took this code from the bootstrap.com website and I am trying to tweak it. I have found which classes control the color of the nav menu and changed it in CSS to the color that I want. I am not however able to figure out which part of the code controls the sub menu hover state. I need to change that color too.

<nav class="navbar navbar-expand-lg">
  <a class="navbar-brand" href="#">Do You Know Jennipher</a>

  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
            
        </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>

      <li class="nav-item">
        <a class="nav-link" href="#">About Me</a>
      </li>

      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Portfolio</a>

        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="#">Egyptian Petrdise</a>
          <a class="dropdown-item" href="#">Movie Madness</a>
          <a class="dropdown-item" href="#">George's Safari Adventure</a>
        </div>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Gallery</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Say Hello</a>
      </li>
    </ul>
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
  </div>
</nav>

The CSS I added is as follows:

 .navbar{
     background-color: #55C9EA;
     font-family:Gotham, "Helvetica Neue", Helvetica, Arial, "sans-serif";
    }

  .dropdown-menu{
      background-color: #55C9EA;
    }
Jaipher
  • 5
  • 4
  • Which is the sub menu here that you are refering to? Can you add your CSS as well that you downloaded ? – Narendra Mar 07 '19 at 02:01

1 Answers1

0

Are you referring to "Egyptian Petrdise, Movie Madness, and George's Safari Adventure" as your submenu? If so just target the class like you did with .navbar and .dropdown-menu. So rather than .dropdown-menu, it'd be .dropdown-item and use the CSS pseudoselector :hover to change colors when hover.

.navbar{
 background-color: #55C9EA;
 font-family:Gotham, "Helvetica Neue", Helvetica, Arial, "sans-serif";
}

.dropdown-menu{
  background-color: #55C9EA;
}

.nav-link {   <---- Targets home, about me, portfolio, gallery, say hello
  color: red;
}

.nav-link:hover {
  color: yellow;
}

.dropdown-item { <--- Targets portfolio submenu
  color: green;
}

.dropdown-item:hover {
  color: purple;
}

Here's a fiddle.

TJS13
  • 56
  • 1
  • 9