Skip to content

Typing Text Effect

Pure CSS typewriter effect with a blinking caret, using steps() and ch units on a monospace headline and a retro terminal window with replay.

Also known as: typewriter effect, typing animation text, terminal typing effect, blinking cursor text

Typing Text Effect live demo

Open in new tab

Pure CSS code (HTML, CSS, JS)

A typewriter text effect in pure CSS with a blinking caret, shown on a monospace headline and a retro terminal window. It works well for developer landing pages, documentation heroes, CLI product pages and portfolio intros.

How it works

The root section.tt-stage holds a .tt-headline, a .tt-replay button and a .tt-terminal with several .tt-row lines. Every piece of text that should type out is wrapped in a .tt-type span. The animation itself is CSS: the span starts at width: 0 with overflow: hidden, and the tt-typing keyframes grow it to calc(var(--tt-chars) * 1ch) using steps(var(--tt-chars)), so exactly one character appears per step. Because the font is monospace, 1ch is the width of one character. The caret is the span's right border, toggled by the tt-blink keyframes and hidden again by tt-caret-off once a line is done. The last line gets .tt-type--last and keeps blinking like a waiting prompt.

The small script measures each span on DOMContentLoaded, sets --tt-chars, --tt-duration and --tt-delay so the lines type one after another, and then adds .tt-ready to the root, which switches the animation on. Spans with data-instant skip the typing and simply appear, like command output. The replay button removes and re-adds .tt-ready to restart everything. Without JavaScript the full text is shown with no animation.

Customization

  • data-speed on .tt-stage: milliseconds per character, e.g. 80 for a slower typist.
  • data-pause on .tt-stage: the pause between lines in milliseconds.
  • data-instant on a .tt-type span: show that line at once instead of typing it.
  • --tt-blink: the caret blink cycle, and --tt-caret-width its thickness.
  • --tt-caret: caret color; it defaults to currentColor, so it matches each line.
  • --tt-term-text, --tt-term-ok and --tt-term-bg: the amber text, green success line and background of the terminal.
  • --tt-font: the monospace font stack; keep a monospace font so 1ch matches every character.

Use cases

  • Developer landing pages: a monospace headline types itself out with a blinking caret
  • CLI product pages: a retro terminal window types commands line by line, with output appearing instantly
  • Documentation heroes: a replay button restarts the animation on demand
  • Portfolio intros: full text stays readable without scripts and for reduced-motion visitors

Accessibility

The typed text is real text in the DOM from the start, so screen readers read the full lines regardless of the animation. The terminal is a role="group" with an aria-label, and the decorative title bar is aria-hidden. The replay button is a native button with a visible :focus-visible outline. With prefers-reduced-motion: reduce all lines are shown immediately and the last caret stays visible without blinking.

Usage notes

Keep each .tt-type on one line: the effect uses white-space: pre and cannot wrap. Do not add letter-spacing to typed text, because it breaks the ch math. Several stages can share a page; each one is set up independently.

Typing Text Effect at a glance

Framework
Pure CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
None
Layout
Responsive, works on mobile
Category
Text Effects
License
Free for personal and commercial use

Questions about this template

Can I use the Typing Text Effect code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

There is nothing to install. Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

No dependencies. Pure HTML, CSS and JavaScript.

Typing Text Effect – free Pure CSS text effect template
Typing Text Effect · free Pure CSS text effect template

More Text Effects

Glitch Text Effect – free Pure CSS text effect template

Glitch Text Effect

Pure CSS glitch heading with sliced cyan and magenta copies, CRT scanlines, and subtle, hover-only and acid palette variants.

Image Clipped Text with Photo Fill – free Pure CSS text effect template

Image Clipped Text with Photo Fill

Large pure CSS heading filled with a slowly panning mountain photo through background-clip text, with a solid color fallback.

Animated Gradient Text – free Pure CSS text effect template

Animated Gradient Text

Pure CSS animated gradient text for headings using background-clip, with four palettes, a shine sweep variant, a CSS-only pause switch and a fallback color.