# Typewriter Text

> Text that types itself out with a blinking caret, using only CSS.

- Category: [CSS Text Effects](https://copy-css.com/category/text)
- Tags: typewriter, typing, animation, caret, monospace
- Live preview: https://copy-css.com/snippets/typewriter-text
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<p class="typewriter">Hello, world!</p>
```

## CSS

```css
/* Set width and steps() to the number of characters */
.typewriter {
  width: 13ch;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid #111;
  font: 600 24px/1.3 ui-monospace, Menlo, monospace;
  animation:
    typewriter-type 2.5s steps(13) infinite alternate,
    typewriter-caret 0.7s step-end infinite;
}

@keyframes typewriter-type {
  from { width: 0; }
}

@keyframes typewriter-caret {
  50% { border-color: transparent; }
}

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

## Notes

- This CSS Typewriter Text is 26 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.
