# Blinking Text Cursor

> A thin blinking caret after any heading or line of text, sized in em so it scales with the font.

- Category: [CSS Text Effects](https://copy-css.com/category/text)
- Tags: caret, blink, hero, terminal, pseudo-element
- Live preview: https://copy-css.com/snippets/blinking-cursor-text
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<h2 class="text-cursor">Hi, I build websites</h2>
```

## CSS

```css
.text-cursor {
  max-width: 11em;
  margin: 0;
  color: #0f172a;
  font: 800 30px/1.2 system-ui, sans-serif;
}

.text-cursor::after {
  content: "";
  display: inline-block;
  width: 0.08em;
  height: 1em;
  margin-left: 0.1em;
  vertical-align: -0.12em;
  background: #2563eb;
  animation: text-cursor-blink 1s step-end infinite;
}

@keyframes text-cursor-blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .text-cursor::after { animation: none; }
}
```

## Notes

- This CSS Blinking Text Cursor is 25 lines of pure CSS (0.5 KB) with no JavaScript and no dependencies. It uses keyframe animations and reduced-motion support.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
