Buttonhoverfilltransition

Fill on Hover

Button fills with color from left to right on hover. Change transform-origin to control fill direction: left, right, center, top, or bottom.

.btn-fill {
  position: relative;
  padding: 12px 24px;
  border: 2px solid #8b5cf6;
  background: transparent;
  color: #8b5cf6;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  transition: color 0.3s;
  z-index: 1;
}
.btn-fill::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #8b5cf6;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
  z-index: -1;
}
.btn-fill:hover { color: white; }
.btn-fill:hover::before { transform: scaleX(1); }

More Button effects