Snippets Buttons

Bootstrap 5 Fill-on-Hover Buttons

Three pill buttons that fill with colour on hover, shown in a cookie-consent card with accept, refuse and more-info actions. The fill sweeps in from the left and works with keyboard focus in light and dark themes.

Bootstrap 5 No jQuery Aug 2019 2.1K views

<section class="wdw-stage">
  <div class="container" style="max-width:860px">
    <div class="wdw-card p-4 p-md-5">
      <div class="d-flex flex-column flex-sm-row align-items-sm-start gap-3 gap-md-4 mb-4">
        <span class="wdw-icon flex-shrink-0" style="width:3.5rem;height:3.5rem" aria-hidden="true">
          <svg viewBox="0 0 24 24" width="28" height="28" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3a9 9 0 1 0 9 9 4 4 0 0 1-4-4 4 4 0 0 1-4-4 1 1 0 0 0-1-1Z"/><circle cx="8.5" cy="11" r=".6" fill="currentColor"/><circle cx="12" cy="16" r=".6" fill="currentColor"/><circle cx="15.5" cy="13" r=".6" fill="currentColor"/></svg>
        </span>
        <div>
          <span class="wdw-eyebrow mb-1">Cookie preferences</span>
          <h2 class="wdw-heading h2 mb-2">Help us make this site better</h2>
          <p class="wdw-muted mb-0">We use cookies to keep you signed in and to understand which pages are useful. You can change your choice at any time.</p>
        </div>
      </div>
      <div class="d-flex flex-column flex-sm-row align-items-sm-center gap-3">
        <button type="button" class="btn fill-btn fill-btn-primary fill-left rounded-pill px-4" data-demo><span>Accept all</span></button>
        <button type="button" class="btn fill-btn fill-btn-secondary fill-center rounded-pill px-4"><span>Refuse</span></button>
        <button type="button" class="btn fill-link fill-up px-2"><span>More info</span></button>
      </div>
      <hr class="my-4">
      <a href="#" class="link-primary fw-semibold small text-decoration-none">Manage preferences</a>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.

Free to use in personal and commercial projects under the MIT license.