A HTML and CSS code snippet post which shows you a webpage nav ui > li list item navigation with hover and focus effect. The snippet utilises the following css elements; css transform, css transition, css ease-in-out and css scale. Sourced under a permissive license.

Creating a nav ui > li list item navigation with hover and focus effect

<nav class="hover-nav">
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Contact</a></li>
  </ul>
</nav>

<style>
.hover-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.hover-nav li {
  float: left;
}

.hover-nav li a {
  position: relative;
  display: block;
  color: #fff;
  text-align: center;
  padding: 8px 12px;
  text-decoration: none;
  z-index: 0;
}

li a::before {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  bottom: 0;
  left: 0;
  background-color: #2683f6;
  z-index: -1;
  transform: scale(0);
  transition: transform 0.5s ease-in-out;
}

li a:hover::before,
li a:focus::before {
  transform: scale(1);
}
</style>

Tags: CSS, HTML, CSS, CSS code snippet, html code snippet, cursor, hover effect, hover image, nav, li, css transform, css transition, css ease-in-out, css scale

Image: Unsplash license

CC BY 4.0 added intro and tags – 30 Seconds of Code