Change the color of the Nav bootstrap 4 link

Asked

Viewed 2,081 times

0

I have the menu below:

Estado atual do menu

But I would like the color of the link to be #3E4095 and the Hover #FFFF00. How can I change the color on Bootstrap 4?

<nav class="navbar navbar-expand-lg navbar-light">
        <a class="navbar-brand" href="#">&nbsp;</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav" style="margin-top: 13px">
          <ul class="navbar-nav">
            <li class="nav-item">
              <a class="nav-link" href="#">Importação</a>
            </li>
            <span class="linha-vertical"></span>
            <li class="nav-item">
              <a class="nav-link" href="#">Exportação</a>
            </li>
            <span class="linha-vertical"></span>
            <li class="nav-item">
              <a class="nav-link" href="#">Curso de Instrutor</a>
            </li>
            <span class="linha-vertical"></span>
            <li class="nav-item">
              <a class="nav-link" href="#">Assessoria Jurídica</a>
            </li>
          </ul>
        </div>
        </nav>

2 answers

0

I managed to solve, but I don’t have much experience with Bootstrap and in case I made a mistake, please correct me.

.navbar-light .navbar-nav .nav-link {
  color: #3E4095;
}
.navbar-light .navbar-nav .nav-link:hover {
  color: #FFFF00;
}

0

If you want a custom color you can do as you did, remembering that it has the class text, as text-success(verde),text-Danger(red)` and so on with standard Bootstrap colors:

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">

<nav class="navbar navbar-expand-lg navbar-light">
  <a class="navbar-brand" href="#">&nbsp;</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNav" style="margin-top: 13px">
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link text-primary" href="#">Importação</a>
      </li>
      <span class="linha-vertical"></span>
      <li class="nav-item">
        <a class="nav-link text-success" href="#">Exportação</a>
      </li>
      <span class="linha-vertical"></span>
      <li class="nav-item">
        <a class="nav-link text-danger" href="#">Curso de Instrutor</a>
      </li>
      <span class="linha-vertical"></span>
      <li class="nav-item">
        <a class="nav-link text-warning" href="#">Assessoria Jurídica</a>
      </li>
    </ul>
  </div>
</nav>

Browser other questions tagged

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