Liquid Glass

1index.html 14 lines

<nav aria-label="Primary" data-glass-scale="2.5">
  <div class="tabs">
    <!-- Fallback pill for browsers without WebGL2. glass.js removes
         it the moment the canvas comes up. -->
    <span class="tab-bubble" aria-hidden="true"></span>

    <a href="/overview" class="tab-active" aria-current="page">Overview</a>
    <a href="/pricing">Pricing</a>
    <a href="/company">Company</a>
  </div>
</nav>

<!-- Last in the body: the script reads the row's layout on load. -->
<script src="glass.js"></script>
2style.css 43 lines

/* The canvas is appended here, so the row is its positioning context. */
.tabs {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(40px, 6vw, 96px);
}

/* Labels sit above the background snapshot and below the lens. */
.tabs a {
  position: relative;
  z-index: 1;
  padding: 16px 24px;
  font-size: 34px;
  color: #5b6472;
  text-decoration: none;
  transition: color .2s;
}
.tabs a:hover,
.tabs a.tab-active { color: #10131a; }

/* The canvas glass.js injects. */
.tab-lens {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

/* The no-WebGL2 fallback, hidden until it's needed. */
.tab-bubble {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(#fff, #f6f7f6);
  border: 1px solid rgba(23, 56, 105, 0.16);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(15, 42, 74, 0.16), 0 0 2px rgba(15, 42, 74, 0.10);
}
3glass.js 653 lines ยท 25 KB Raw

This one needs JavaScript to load. The raw file is the same 653 lines.