简体   繁体   中英

CSS: Change font color by hover effect

I know it's probably an easy question but how can I change my font color in a hover effect? So if I try it my font color doesn't change when I go with my mouse over it.

nav ul li:hover {
 background-color:#ffffff;
 color: #000000;
}

EDIT: Hey guys thanks for your answer! The solution was:

a:hover{color:#000000};

Thank you a lot!

Try this:

<style>
li:hover {
    color: red;
}
</style>


<nav>
  <ul>
    <li>hi</li>
  </ul>
</nav>

Hope this helps

if your font is under in <a href then plz try by this way

nav ul li a:hover {
 background-color:#ffffff;
 color: #000000;
}

你可以试试这个

 li a:hover { background-color: green; }
nav:hover, ul:hover, li:hover{
 background-color:#ffffff;
 color: #000000;
}
nav ul li:hover a{
  background:#fff;
  color:#000;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM