Back to CSS Link Effects Squiggly Underline Pure CSS
Share
HTML
<nav class="cle-squig-nav">
  <a href="#" class="cle-squig">home</a>
  <a href="#" class="cle-squig is-active">blog</a>
  <a href="#" class="cle-squig">work</a>
  <a href="#" class="cle-squig">about</a>
</nav>
CSS
.cle-squig-nav {
  display: flex;
  gap: 28px;
}
.cle-squig {
  position: relative;
  padding-bottom: 14px;
  color: #c5e8ff;
  font:
    600 18px/1.2 "Caveat",
    "Comic Sans MS",
    cursive;
  text-decoration: none;
  transition: color 0.25s;
}
.cle-squig.is-active {
  color: #ddff8a;
}
.cle-squig::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: 0;
  height: 10px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 10' preserveAspectRatio='none'><path d='M2 5 Q 12 0 22 5 T 42 5 T 62 5 T 78 5' stroke='%23ddff8a' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-size: 0% 100%;
  background-position: left center;
  transition: background-size 0.55s cubic-bezier(0.65, 0, 0.35, 1);
}
.cle-squig:hover::after,
.cle-squig:focus-visible::after,
.cle-squig.is-active::after {
  background-size: 100% 100%;
}