# Animated Underline

> A link underline that draws in from the left and exits to the right.

- Category: [CSS Text Effects](https://copy-css.com/category/text)
- Tags: link, underline, hover, navigation
- Live preview: https://copy-css.com/snippets/underline-link
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<a class="link-underline" href="#">Read the docs</a>
```

## CSS

```css
.link-underline {
  position: relative;
  color: #111;
  font: 600 22px/1.4 system-ui, sans-serif;
  text-decoration: none;
}

.link-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.link-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}
```

## Notes

- This CSS Animated Underline is 24 lines of pure CSS (0.4 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.
