Edit This Code:
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../lib/w3.css">
<body class="w3-container">

<h2>Hoverable Links</h2>
<p>When you mouse over the links inside the nav, their background color will change to grey by default.</p>
<p>If you want a different background color on hover, use any of the <strong>w3-hover-color</strong> classes, and if you want a different text color on hover, use any of the
<strong>w3-hover-text-color</strong> classes.</p>

<p>Hover background color:</p>
<ul class="w3-navbar w3-border w3-light-grey">
  <li><a class="w3-hover-red" href="tryit.asp-filename=tryw3css_navbar_hover.html#">Home</a></li>
  <li><a class="w3-hover-blue" href="tryit.asp-filename=tryw3css_navbar_hover.html#">Link 1</a></li>
  <li><a class="w3-hover-green" href="tryit.asp-filename=tryw3css_navbar_hover.html#">Link 2</a></li>
  <li><a class="w3-hover-teal" href="tryit.asp-filename=tryw3css_navbar_hover.html#">Link 3</a></li>
</ul>

<p>Hover text color (You can turn off the default hover effect with the <strong>w3-hover-none</strong> class. This is often used when you only want to highlight text color (and not background color) on hover):</p>
<ul class="w3-navbar w3-black">
  <li><a class="w3-hover-none w3-text-white" href="tryit.asp-filename=tryw3css_navbar_hover.html#">Home</a></li>
  <li><a class="w3-hover-none w3-text-grey w3-hover-text-white" href="tryit.asp-filename=tryw3css_navbar_hover.html#">Link 1</a></li>
  <li><a class="w3-hover-none w3-text-grey w3-hover-text-white" href="tryit.asp-filename=tryw3css_navbar_hover.html#">Link 2</a></li>
  <li><a class="w3-hover-none w3-text-grey w3-hover-text-white" href="tryit.asp-filename=tryw3css_navbar_hover.html#">Link 3</a></li>
</ul>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy