AI CSS Animations

Fill Up Button

The fill rises from the bottom edge instead of sliding sideways. Same one pseudo-element, different axis, and it pairs well with the slide version on the same page.

Also known as: bottom fill hover, rising fill button.

HTML

<button class="hfx-fill-up">Book a demo</button>

CSS

.hfx-fill-up {
  --c: var(--hfx-color, #3b82f6);
  font-size: var(--hfx-size, 16px);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.7em 1.6em;
  border-radius: 0.5em;
  font: 600 1em system-ui, sans-serif;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 2px solid var(--c);
  background: transparent;
  color: var(--c);
  transition: color 0.3s ease;}
.hfx-fill-up::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--c);
  transform: translateY(101%);
  transition: transform 0.3s ease;
}
.hfx-fill-up:hover { color: #fff; }
.hfx-fill-up:hover::before { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .hfx-fill-up, .hfx-fill-up *, .hfx-fill-up::before, .hfx-fill-up::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --hfx-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --hfx-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 16px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar hover effects