Skip to content

Underline Slide

A copy-paste buttons component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

ButtonsHTMLCSSany framework

Copy into your project

HTML
<!-- Underline Slide — text underline slides in on hover -->
<button class="nuda-underline-slide">Underline Slide</button>
CSS
/* ── Underline Slide ─────────────────────────────────────────
   Customize:
     --nuda-us-clr     : text & underline color
     --nuda-us-weight  : underline thickness
     --nuda-us-speed   : slide-in speed
     --nuda-us-gap     : distance below text
   ──────────────────────────────────────────────────────────── */
.nuda-underline-slide {
  --nuda-us-clr: #6366f1;
  --nuda-us-weight: 2px;
  --nuda-us-speed: 0.3s;
  --nuda-us-gap: 2px;

  position: relative;
  display: inline-block;
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--nuda-us-clr);
  background: transparent;
  border: none;
  cursor: pointer;
}

.nuda-underline-slide::after {
  content: "";
  position: absolute;
  bottom: calc(6px + var(--nuda-us-gap));
  left: 32px;
  right: 32px;
  height: var(--nuda-us-weight);
  background: var(--nuda-us-clr);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--nuda-us-speed) ease;
}

.nuda-underline-slide:hover::after {
  transform: scaleX(1);
}

/* ── Accessibility ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .nuda-underline-slide::after {
    transition: none;
  }
}

How to use Underline Slide

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More buttons components

← Browse all NudaUI components