Text✨ Premium

Typewriter Variable

Reveals monospace text letter by letter using the Recursive variable font and a blinking cursor — pure CSS, zero JavaScript.

CSSTypewriterMono

You'll get access to the interactive demo with a free account.

This effect is part of Effect.Labs — 811 vanilla effects, some free, some premium. Text has 56 effects, including 4 free. Explore the category →

3 usage examples

Developer landing page — Terminal hero — Typewriter Variable example 1

① Developer landing page — Terminal hero

WhenThe visitor lands on the homepage of a CLI tool, API, or technical SaaS — a terminal in the hero immediately communicates the value proposition.
WhyMonospace text and a blinking cursor trigger instant terminal recognition for developers. It fills the available width and anchors the page in a tech context without requiring any illustration.
SettingsText color #10b981 (terminal green), size 1.4rem, steps(24) for 24 characters, duration 5s (slow typing, easy reading).
Documentation card — Live code snippet — Typewriter Variable example 2

② Documentation card — Live code snippet

WhenOn a documentation page or interactive README, a card showcases the key API line — the animation draws the eye to the most important example.
WhyMaking a static code line 'live' increases perceived readability and guides the developer to the essential information. The dark card background isolates the snippet from the rest of the page.
SettingsSize 1rem, font-variation-settings: "MONO" 1, "CASL" 0, "wght" 500 for slightly bolder weight, color #a78bfa to match a violet/indigo palette.
Creative portfolio — Interactive bio on load — Typewriter Variable example 3

③ Creative portfolio — Interactive bio on load

WhenThe About page of a developer or technical designer reveals their title or specialty in typewriter mode — the progressive reveal captures attention immediately.
WhyThe typewriter is one of the few expressive animations that stays understated. On a dark background, it positions the author in a craft universe without requiring any illustration.
SettingsSize 2rem, "wght" 700 for a bold heading, color #f1f5f9 (off-white), duration 6s, steps(28), single line without context lines.

How it works

The text is fully written in the DOM but hidden behind overflow: hidden; white-space: nowrap. The vfType animation steps the width from 0 to 280px in steps(20) — 20 equal discrete jumps — visually simulating character-by-character reveal. The 50%–80% pause keeps the text visible before erasing, then the cycle repeats indefinitely.

The cursor is the element's own border-right: 2px solid. The vfBlink animation toggles the border color to transparent at 50% with step-end timing — no fade, hard jump — exactly reproducing a classic terminal cursor blink.

The Recursive font is a variable font: the axis "MONO" 1 switches its type engine to strict monospace spacing (every glyph at identical width). This is what makes the steps() technique convincing — each width jump matches exactly one character. The "CASL" (cursiveness) and "wght" (weight) axes are available to vary the style without changing the font.

Context lines (.vf-typewriter-line) use the same Recursive Mono at 0.75rem and 30% opacity — they represent previous and upcoming terminal commands, providing context without drawing attention. The whole scene is centered with vertical flexbox.

Accessibility

  • prefers-reduced-motion: ABSENT from the code — the typing animation and cursor blink run even when the OS signals reduce. To fix, add: @media (prefers-reduced-motion: reduce) { .vf-typewriter-text { animation: none; width: 280px; border-right: none; } }
  • Text is directly in the DOM (native <span>) — screen readers read it without obstacle, no aria-hidden or canvas involved.
  • Contrast: #10b981 (Emerald green) on #0a0a0f background → ratio ≈ 8.5:1, WCAG AAA level (normal text). Verify the ratio if you change the color.
  • No keyboard interaction required — the effect is purely decorative, nothing focusable.
  • The HTML structure carries no role or aria-label. For hero use, add role="img" aria-label="Terminal animation" to the container.

Browser compatibility

Requires CSS animation, steps(), and font-variation-settings — available in all browsers that support variable fonts.

Chrome 62+✓ Full
Firefox 62+✓ Full
Safari 11+✓ Full
Edge 18+✓ Full
Mobile iOS 11+✓ Full
Android Chrome 62+✓ Full

If Recursive is unavailable, the browser falls back to the system <code>monospace</code> font (Courier New, Consolas…). The animation still works; the visual rendering changes slightly. Without <code>font-variation-settings</code> support, Recursive displays in its default static style.

The code

HTML structure to paste into your page (CSS + JS available with a premium account):

index.html — structure
<div class="vf-preview">
  <div class="vf-typewriter-scene">
    <span class="vf-typewriter-line">
      <span class="vf-typewriter-prompt">$</span> previous-command
    </span>
    <span class="vf-typewriter-text">text to animate here</span>
    <span class="vf-typewriter-line">
      <span class="vf-typewriter-prompt">$</span> next-command
    </span>
  </div>
</div>
🔒 Unlock the full code — from €2.99 the first month

Full HTML + CSS + JS, copy-paste ready — with hundreds of premium effects.

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
animation-duration (vfType) 4s Duration of one full typing cycle. Increase to 6–8s for slow, readable typing; reduce to 2s for a snappy feel.
steps(20) in vfType 20 Number of columns revealed per cycle — should match the character count of your text for perfect alignment. Count your characters (including spaces) and adjust.
max-width on .vf-typewriter-text 280px Maximum visible length. Align with the actual text width at your chosen font size to avoid clipping.
color on .vf-typewriter-text #10b981 Text and cursor color (the border-right inherits the same value via the color property).
font-size on .vf-typewriter-text 1.2rem Animated text size. Adjust in sync with max-width and steps().
font-variation-settings on .vf-typewriter-text "MONO" 1, "CASL" 0, "wght" 400 Recursive variable font axes. "CASL" 1 = cursive style, "wght" 700 = bold, "MONO" 1 required for fixed-width spacing.
color on .vf-typewriter-prompt #8b5cf6 Prompt symbol color ($). Adapt to your brand palette.
color on .vf-typewriter-line rgba(255,255,255,0.3) Opacity of context lines (static commands around the animated text).
gap on .vf-typewriter-scene 12px Vertical spacing between terminal lines. Increase to air out, decrease to compact.

FAQ

Yes, entirely. The effect uses only CSS: two @keyframes, an animation property, and font-variation-settings. No .js file needed. Copy the HTML and CSS, add the Recursive font via Google Fonts, and you're done.
Edit the content of the <span class="vf-typewriter-text"> directly. Then adjust steps(N) in the vfType animation to match your character count (include spaces), and tweak max-width so the line is not clipped.
Not directly with this code: the animation is a fixed cycle on a single text. To cycle multiple texts without JS, stack <span> elements with absolute positioning and offset their animation-delay values. With a small JS helper, the cleanest approach is to swap textContent at the reset moment (when width returns to 0).