Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't change highlight hover color in a nav bar using Materialize CSS

I want to change the hover bg color in a nav bar for another one using MaterializeCSS , the default effect just make the highlight darker, i need to change that highlight to another color like white.

When the navbar color is black, there is no highlight or hover effect.

I can change the bg of the nav bar color, the text color but i can't change the background highlight color, any ideas?

Thank you in advance

<!DOCTYPE html>
<html>

<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.2/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.2/js/materialize.min.js"></script>

<style>    
nav ul li a{
  color: orange;
}    
</style>
</head>

<body>
<header class="top-nav">

<div class="navbar-fixed">
  <nav>
    <div class="nav-wrapper black blue-text">
      <a href="#!" class="brand-logo center">Logo</a>
      <ul class="left hide-on-med-and-down">
        <li><a href="sass.html">Sass</a></li>
        <li><a href="badges.html">Components</a></li>
        <li class="active"><a href="collapsible.html">JavaScript</a></li>
      </ul>
    </div>
  </nav>
</div>

</header>
<main></main>
<footer></footer>
</body>
</html>

In Jsbin here :)

like image 841
Tony Avatar asked Jan 26 '16 19:01

Tony


People also ask

How do I change the color of a navbar in materialize CSS?

You can change color of your navbar by just adding name of color as a class you can pick colors from Colors. If you want the color header of the menu to be same as navbar use . navbar-full class with your <aside> tag.

How do I change the color of hovering in CSS?

To change the color when hovering in CSS, you will use the CSS selector called :hover . The :hover is a CSS pseudo-class that will select the HTML element when the user hovers over with the mouse. The hover selector will work on almost all HTML elements.

What is NAV wrapper?

As a reminder nav wrapper templates are templates that typically produce the header and footer markup that wraps around the content of each page. This is done so that you have don't have to handle all this output in each individual page template.


1 Answers

Just add this rule to your css:

nav ul li:hover {
   background-color: white;
}

It changes the background color of the item on hover. In this example: http://jsbin.com/yemegejeye/edit?html,output it's white.

like image 166
RodrigoDela Avatar answered Sep 28 '22 05:09

RodrigoDela