# Highlight Sweep

> A marker highlight that sweeps in behind key words from left to right when the page loads.

- Category: [CSS Text Effects](https://copy-css.com/category/text)
- Tags: marker, mark, animation, emphasis, background-size
- Live preview: https://copy-css.com/snippets/highlight-sweep
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<p class="hl-sweep">Launch <mark>twice as fast</mark> with less code.</p>
```

## CSS

```css
.hl-sweep {
  max-width: 12em;
  margin: 0;
  color: #1f2937;
  font: 700 26px/1.4 system-ui, sans-serif;
}

.hl-sweep mark {
  padding: 0 0.15em;
  color: inherit;
  background: linear-gradient(100deg, #fde047, #facc15) no-repeat 0 0 / 0% 100%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  animation: hl-sweep-in 0.9s 0.3s cubic-bezier(0.6, 0, 0.3, 1) forwards;
}

@keyframes hl-sweep-in {
  to { background-size: 100% 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .hl-sweep mark {
    animation: none;
    background-size: 100% 100%;
  }
}
```

## Notes

- This CSS Highlight Sweep is 26 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It uses keyframe animations, linear gradients and reduced-motion support.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
