Created with Facet And a little HTMX

Options

Declaration in HTML:

<fancy-hyperlink href="https://example.com"> 
  Example.com
</fancy-hyperlink>

Component definition (in HTML, CSS):

<template component="fancy-hyperlink">

<h1>
  <a class="link" inherit="href">
    <slot></slot>
  </a>
</h1>

<style>
a,
a:hover,
a:active,
a:visited {
  cursor: pointer;
  text-decoration: none;
}
.link {
  display: block;
  position: relative;
  margin-inline: 25px;
  font-size: 36px;
  color: darkblue;
}
.link:before {
  content: "";
  width: 0;
  height: 2px;
  background-color: #0fa3ff;
  position: absolute;
  top: 100%;
  left: 0;
  transition: width 0.3s ease-in-out;
}
.link:hover:before {
  width: 100%;
  z-index: -1;
}
</style>

</template>

+ One 2.47 KB script file over CDN to try:

Facet 0.1.0 Me: Fancy hyperlink to
https://morganwebdev.com