# Fill on Hover Button

> An outlined pill button that fills with color from left to right on hover.

- Category: [CSS Buttons](https://copy-css.com/category/buttons)
- Tags: outline, hover, pill, animation
- Live preview: https://copy-css.com/snippets/fill-button
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<button class="btn-fill">Hover me</button>
```

## CSS

```css
.btn-fill {
  position: relative;
  z-index: 0;
  overflow: hidden;
  padding: 14px 32px;
  border: 2px solid #0284c7;
  border-radius: 999px;
  background: transparent;
  color: #0284c7;
  font: 600 16px/1 system-ui, sans-serif;
  cursor: pointer;
  transition: color 0.3s ease;
}

.btn-fill::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #0284c7;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.btn-fill:hover {
  color: #fff;
}

.btn-fill:hover::before {
  transform: scaleX(1);
}
```

## Notes

- This CSS Fill on Hover Button is 32 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It uses transitions and transforms.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
