GLITCH LAB v1.0 ezolab.dev / lab instrument SYS: READY โœฆ Holiday cards

Effects/ CRT Screen [FX_07]/ Calibrated

CRT Screen

Copies a link to this page with your text and settings โ€” whoever opens it sees the same effect. Send it to a friend, a colleague or save it for later.
Pure CSS Light ยท zero deps #animation#neon#terminal#text

CSS CRT effect: neon phosphor text with scanlines, a rolling band, flicker and a power-off into a line and a dot. Pure CSS, no JS.

Live viewport Optical bench
LIVE FEED 60.0 FPS | FRAME: 16.7ms RES: โ€” [ + calibrated ]
Type any word: the preview changes at once, and so do the HTML you copy, the .zip and CodePen. Leave it empty to get the default word back.

How it works // breakdown

Spec-FX_07

This is a CSS CRT effect: text glowing on an old tube monitor behind curved glass, with scanlines, a fine RGB phosphor mask, a soft band rolling down, a flicker with a sync slip โ€” and now and then the power goes off: the picture collapses into a line, the line into a white-hot dot, and the dot slowly fades, just like a real CRT. It's pure CSS, no JavaScript and no canvas, and every setting is a CSS variable you can change live. Below: how each layer works, the settings, and the traps.

Why this effect

Most CRT effects are green or white terminal text. I wanted the screen to glow like a neon tube instead โ€” warm yellow phosphor, a hot pale core and a red and blue fringe where the beams don't quite line up. The part I always wait for is the power-off: the picture squeezes into a bright line, the line into a white-hot dot, and the dot glows for a moment before it fades. Everyone who has turned off an old TV knows that moment.

What you'll build

A rounded dark screen in a thin bezel, with edges that fall into shadow like curved glass and a faint reflection in the corner. The letters glow in three layers, thin scanlines and red, green and blue phosphor stripes run over everything, a faint bright band rolls down every 6 seconds, and now and then the brightness dips and the picture slips sideways for a moment. After a few seconds the screen switches off โ€” line, hot dot, afterglow, darkness โ€” and switches back on. Everything scales with the text size, so the same screen fits a short word or a long title.

How the CRT effect works

1. The screen: curved glass in a bezel

The wrapper is the screen. overflow: hidden keeps the scanlines and the rolling band inside it, and an elliptical border-radius makes it look like a tube โ€” wider than it is tall. CSS can't bend the glass, but light can fake it: an inset shadow darkens the edges the way a curved tube falls away from you, and a soft white ellipse in the top left corner is the room reflected in the glass. Two thin outer shadows are the bezel, and one wide, faint shadow in the glow colour is the light the screen throws on the wall.

.cr-crt {
  position: relative;
  overflow: hidden;
  padding: 1.15em 0.55em;
  border-radius: 0.4em / 0.6em;
  background:
    radial-gradient(ellipse 60% 45% at 28% 18%, rgb(255 255 255 / 0.07), transparent 70%),
    radial-gradient(color-mix(in srgb, var(--cr-glow) 15%, #030405), #030405 80%);
  box-shadow:
    inset 0 0 0.5em 0.12em rgb(0 0 0 / 0.9),   /* curved glass */
    0 0 0 0.05em #0b0b0c,                      /* bezel */
    0 0 0 0.065em #1d1e21,
    0 0 1.2em color-mix(in srgb, var(--cr-glow) 14%, transparent);  /* light on the wall */
}

Padding, radius and shadows are in em, and the screen's font-size is the text size โ€” so a bigger word gets a bigger screen automatically.

2. Phosphor: a hot core and two colour fringes

On a real CRT three electron beams draw red, green and blue. When they are slightly out of line, the edges of the letters get colour fringes. Two hard text-shadows do that: red one way, blue the other. Then three soft shadows make the glow โ€” tight, medium and a wide warm halo.

.cr-crt > * {
  color: #fff8c2;
  text-shadow:
    -2px 0 rgb(255 0 0 / 0.7),
    2px 0 rgb(0 0 255 / 0.7),
    0 0 0.12em #ffe600,
    0 0 0.28em #ffd000,
    0 0 0.67em #ff9e00;
}
The same word: plain, with fringes, with fringes and glow

3. CSS scanlines and a phosphor mask

Scanlines are a repeating-linear-gradient on a ::before that covers the whole screen: 2px clear, 2px darker, repeated. Over them goes a second gradient, sideways: 1px stripes of red, green and blue โ€” the phosphor mask a real tube draws its picture through. Look closely at an old monitor and you see exactly these stripes.

The trick is mix-blend-mode: multiply. Multiply can only darken: white lets everything through, and a reddish stripe lets red through and dims green and blue. So the layer works as a filter in front of the picture, not as paint on top of it.

.cr-crt::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: multiply;
  background:
    repeating-linear-gradient(#fff 0 2px, rgb(255 255 255 / 0.7) 2px 4px),
    repeating-linear-gradient(90deg,
      #fff0f0 0 1px, #f0fff0 1px 2px, #f0f0ff 2px 3px);
}
The phosphor mask, exaggerated โ€” at the real strength you only feel it

pointer-events: none keeps the text selectable and clickable under the layer. The lines and stripes stay in px on purpose: they are the screen's pixels, not part of the text, so they keep the same fine pitch at any size.

4. The rolling band and the flicker

A real CRT often shows a slow bright band crawling down the picture. Here it's a gradient 30% tall on the ::after, moved with background-position. For a background smaller than its box, the percentage counts the free space, so -43% puts the band just above the glass and 143% just below.

.cr-crt::after {
  inset: 0;
  background: linear-gradient(transparent, rgb(255 255 255 / 0.06), transparent)
    0 -43% / 100% 30% no-repeat;
  animation: cr-roll 6s linear infinite;
}
@keyframes cr-roll { to { background-position: 0 143%; } }

The letters also breathe: opacity drifts to 0.92, dips to 0.75 โ€” and at that moment the picture slips sideways, the way a CRT loses sync for a frame: a jerk to the right, a smaller swing back, a tiny one again, and it settles.

@keyframes cr-flicker {
  0%, 50%, 59%, 100% { transform: none; }
  53% { opacity: 0.75; transform: translateX(0.03em); }
  55% { transform: translateX(-0.015em); }
  57% { transform: translateX(0.006em); }
}

5. Power-off: a line, a hot dot, afterglow

The whole screen is squashed with scale(): first vertically to a thin line (scaleY(0.006)), then horizontally into a dot. While it shrinks, brightness(3) makes the line burn โ€” the energy of the whole picture is now in one strip โ€” and the dot burns even brighter. The border-radius turns into 50% on the way, so the line gets round ends and the dot is round; the bezel and the glass shadow fade, because a collapsed picture is just light.

A tiny copy of the picture still doesn't look like a dot, so the ::after gets one more layer: a white radial gradient whose opacity follows the dot stage. The dot then fades over almost a second, slower than everything else โ€” that's the phosphor's afterglow. Power-on is the same in reverse: a line stretches out and opens into the picture.

In the video version it's simple keyframes, and it stops at a line and a dot:

@keyframes power {
  0%, 70%, 100% { transform: none; filter: none; }
  76% { transform: scale(1, .006); filter: brightness(3); }
  80% { transform: scale(0, .006); filter: brightness(3); }
  86% { transform: scale(0, .006); }
  93% { transform: scale(1, .006); filter: brightness(2); }
}

6. A pause you can change: keyframes turned into formulas

With keyframes, a longer pause would stretch the power-off too. So the full version uses a clock instead: --cr-t runs from 0 to 1 once per cycle (@property makes it animatable), and --cr-s is the number of seconds into the power-off โ€” negative while the screen is on. Each stage is a 0 โ†’ 1 ramp with clamp(), smoothed with xยฒ(3 โˆ’ 2x) so it starts and stops softly, like ease-in-out:

--cr-s: calc(var(--cr-t) * (var(--cr-pause) + 2.6) - var(--cr-pause));
--cr-a: clamp(0, var(--cr-s) / 0.4, 1);             /* squash into a line */
--cr-ea: calc(var(--cr-a) * var(--cr-a) * (3 - 2 * var(--cr-a)));

Now --cr-pause changes only how long the screen stays on; the power-off always takes 2.6 seconds. The same clock trick is explained step by step in How to Add a Pause Between CSS Animation Loops.

Make it yours

Variable What it does
--cr-pause Seconds the screen stays on before the next power-off.
--cr-lines Scanline darkness: 0 turns them off, 0.5 is a heavy old set.
--cr-mask Strength of the red, green and blue phosphor stripes. 0 is smooth glass.
--cr-fringe How far the red and blue fringes stick out. 0 is a perfect tube.
--cr-size Text size; the screen's padding, corners and bezel follow it.
--cr-core, --cr-glow, --cr-halo The phosphor: hot centre, glow, outer halo. Green #d8ffd0 / #39ff14 / #00a020 gives the classic terminal.

Spacing: padding is the glass around the text (in em, so it grows with the text); margin: 0 is the space around the screen on your page โ€” set your own.

Gotchas

  • The pause is a <number>, not a time: write --cr-pause: 8, not 8s. It goes into calc() with other numbers.
  • @property is needed for the clock. Browsers without it (very old ones) show the screen without the power-off; the rest still works.
  • Scanlines and zoom: at browser zoom or on some phone screens a 2px pitch or the 1px stripes can shimmer (moirรฉ). If they do, use 3px / 6px lines and set --cr-mask: 0.
  • Many screens on a page: each one animates filter, which is not free. A few are fine; for a grid of them, drop the power-off or run it on hover.

Accessibility

The text is real text: selectable, readable by screen readers and search engines. With prefers-reduced-motion: reduce the flicker, the rolling band and the power-off stop โ€” the screen just glows behind its glass.

Variations

  • Neon without the screen, with one flickering letter: Neon Sign.
  • Green terminal text that types itself: Typewriter โ€” put it inside .cr-crt for a full retro monitor.
  • Decrypting text for the same terminal: Scramble Text.

FAQ

How do I make a CRT effect in CSS?

Put the text in a dark rounded box with overflow: hidden, give the letters a pale colour with red and blue text-shadow fringes and a soft glow, darken the edges with an inset box-shadow, and lay scanlines over it with a repeating-linear-gradient on a pseudo-element. A rolling band, a flicker and a scale() power-off make it feel alive. No JavaScript needed.

How do I make CSS scanlines?

One gradient on a pseudo-element that covers the element: repeating-linear-gradient(transparent 0 2px, rgb(0 0 0 / 0.25) 2px 4px). Set pointer-events: none so it doesn't block clicks, and keep the pitch in px. For the RGB phosphor look, add sideways red, green and blue stripes and blend the layer with mix-blend-mode: multiply.

How do I make a CRT turn-off animation in CSS?

Scale the screen to scale(1, 0.006) โ€” a thin line โ€” then shrink it into a small round dot while raising filter: brightness() to 3โ€“5, and let the dot fade slowly, like phosphor afterglow.

Can I use this CRT effect on a whole website?

Yes โ€” put the .cr-crt class on a big container instead of a heading. Keep the power-off rare (a long --cr-pause) or turn it off, so the page stays usable, and remember the reduced-motion rule.

Get the code โ€” copy or download
Copy HTML: the markup with your text โ€” paste it where the effect should be. Copy CSS: the styles with your slider settings โ€” paste into your stylesheet. Any text element works: give it the class and a data-text equal to its text.
or
โ†“ Download .zip Both files in one archive โ€” index.html and style.css โ€” with your text and settings. Unzip and open index.html in a browser.
/* CRT Screen โ€” text glowing on an old tube monitor. Pure CSS.
   Neon phosphor with red and blue fringes, curved dark glass with a
   reflection, scanlines and an RGB phosphor mask, a bright band rolling
   down, a breathing flicker with a sync wobble โ€” and now and then the
   power goes off: the picture collapses into a line, the line into a
   hot dot, the dot slowly fades, and the screen comes back on.
   The screen is the wrapper (class="cr-crt"); everything is sized in em
   from --cr-size, so the screen grows with your text.
   Font: Space Grotesk (Google Fonts), falls back to system-ui.
   Settings: change the variables below. */
.cr-crt {
  --cr-pause: 5.6;      /* seconds the screen stays on between power-offs */
  --cr-lines: 0.3;      /* scanline darkness, 0 = no scanlines */
  --cr-mask: 0.06;      /* RGB phosphor stripes, 0 = smooth glass */
  --cr-fringe: 2px;     /* how far the red and blue fringes stick out */
  --cr-size: 120px;     /* text size; the screen follows it */
  --cr-core: #fff8c2;   /* the hot centre of the letters */
  --cr-glow: #ffe600;   /* glow around them */
  --cr-halo: #ff9e00;   /* outer, warmer glow */

  position: relative;
  overflow: hidden;
  margin: 0;                    /* margin: space around the screen on your page */
  padding: 1.15em 0.55em;       /* padding: glass around the text (em = text size) */
  /* a tube is wider than it is tall; collapsed, the line and the dot are round */
  border-radius:
    calc(0.4em * var(--cr-on) + 50% * (1 - var(--cr-on))) /
    calc(0.6em * var(--cr-on) + 50% * (1 - var(--cr-on)));
  font-size: var(--cr-size);
  background:
    /* reflection of the room on the curved glass, top left */
    radial-gradient(ellipse 60% 45% at 28% 18%, rgb(255 255 255 / 0.07), transparent 70%),
    /* the phosphor glows a little even between the letters */
    radial-gradient(color-mix(in srgb, var(--cr-glow) 15%, #030405), #030405 80%);
  box-shadow:
    /* curved glass: the edges fall into shadow */
    inset 0 0 0.5em 0.12em rgb(0 0 0 / calc(0.9 * var(--cr-on))),
    /* a thin dark bezel (hidden while the picture is collapsed) */
    0 0 0 0.05em rgb(11 11 12 / var(--cr-on)),
    0 0 0 0.065em rgb(29 30 33 / var(--cr-on)),
    /* the screen lights up the room around it */
    0 0 1.2em color-mix(in srgb, var(--cr-glow) 14%, transparent);

  /* A clock: --cr-t runs 0 โ†’ 1 once per cycle (screen on + 2.6 s power-off) */
  animation: cr-clock calc((var(--cr-pause) + 2.6) * 1s) linear infinite;
  /* --cr-s: seconds into the power-off (negative while the screen is on) */
  --cr-s: calc(var(--cr-t) * (var(--cr-pause) + 2.6) - var(--cr-pause));
  /* Five stages of the power-off, each 0 โ†’ 1 */
  --cr-a: clamp(0, var(--cr-s) / 0.4, 1);           /* picture squashes into a line */
  --cr-b: clamp(0, (var(--cr-s) - 0.4) / 0.3, 1);   /* line pulls into a hot dot */
  --cr-c: clamp(0, (var(--cr-s) - 0.7) / 0.9, 1);   /* the dot fades slowly (afterglow) */
  --cr-d: clamp(0, (var(--cr-s) - 1.9) / 0.3, 1);   /* power on: a line stretches out */
  --cr-e: clamp(0, (var(--cr-s) - 2.2) / 0.4, 1);   /* the line opens into the picture */
  /* Smooth start and stop for each stage: xยฒ(3 โˆ’ 2x), like ease-in-out */
  --cr-ea: calc(var(--cr-a) * var(--cr-a) * (3 - 2 * var(--cr-a)));
  --cr-eb: calc(var(--cr-b) * var(--cr-b) * (3 - 2 * var(--cr-b)));
  --cr-ec: calc(var(--cr-c) * var(--cr-c) * (3 - 2 * var(--cr-c)));
  --cr-ed: calc(var(--cr-d) * var(--cr-d) * (3 - 2 * var(--cr-d)));
  --cr-ee: calc(var(--cr-e) * var(--cr-e) * (3 - 2 * var(--cr-e)));
  --cr-on: calc(1 - var(--cr-ea) + var(--cr-ee));   /* 1 = full picture, 0 = collapsed */
  --cr-dot: calc(var(--cr-eb) - var(--cr-ed));       /* the hot dot: lights up, then goes */
  transform: scale(
    calc(1 - 0.989 * var(--cr-eb) + 0.989 * var(--cr-ed)),
    calc(1 - 0.994 * var(--cr-ea) + 0.023 * var(--cr-eb)
           - 0.023 * var(--cr-ed) + 0.994 * var(--cr-ee)));
  /* the line burns at 3ร—, the dot at 5ร—, then fades out; back on at 3ร— */
  filter: brightness(calc(1 + 2 * var(--cr-ea) + 2 * var(--cr-eb) - 4 * var(--cr-ec)
                          + 2 * var(--cr-ed) - 2 * var(--cr-ee)));
  opacity: calc(1 - var(--cr-ec) + var(--cr-ed));
}

/* Neon phosphor: hot core, red and blue fringes, glow in three layers */
.cr-crt > * {
  margin: 0;
  font: 700 1em/1.2 "Space Grotesk", system-ui, sans-serif;
  white-space: nowrap;
  color: var(--cr-core);
  text-shadow:
    calc(var(--cr-fringe) * -1) 0 rgb(255 0 0 / 0.7),
    var(--cr-fringe) 0 rgb(0 0 255 / 0.7),
    0 0 0.12em var(--cr-glow),
    0 0 0.28em color-mix(in srgb, var(--cr-glow), var(--cr-halo) 30%),
    0 0 0.67em var(--cr-halo);
  /* The tube breathes, dips, and the picture slips sideways for a moment */
  animation: cr-flicker 3s ease-in-out infinite;
}

/* Scanlines and the phosphor mask (thin R, G, B stripes) over everything.
   multiply only darkens: each stripe lets mostly its own colour through. */
.cr-crt::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: multiply;
  background:
    repeating-linear-gradient(
      rgb(255 255 255) 0 2px, rgb(255 255 255 / calc(1 - var(--cr-lines))) 2px 4px),
    repeating-linear-gradient(90deg,
      rgb(255 calc(255 * (1 - var(--cr-mask) * 4)) calc(255 * (1 - var(--cr-mask) * 4))) 0 1px,
      rgb(calc(255 * (1 - var(--cr-mask) * 4)) 255 calc(255 * (1 - var(--cr-mask) * 4))) 1px 2px,
      rgb(calc(255 * (1 - var(--cr-mask) * 4)) calc(255 * (1 - var(--cr-mask) * 4)) 255) 2px 3px);
}

/* A soft bright band rolls down the glass. On top of it, the hot dot:
   it lights up as the line pulls together and goes when the power is back. */
.cr-crt::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(closest-side,
      rgb(255 255 245 / var(--cr-dot)) 40%,
      color-mix(in srgb, var(--cr-glow) calc(var(--cr-dot) * 100%), transparent) 75%,
      transparent),
    linear-gradient(transparent, rgb(255 255 255 / 0.06), transparent)
      0 -43% / 100% 30% no-repeat;
  animation: cr-roll 6s linear infinite;
}

/* the band is 30% tall: -43% puts it just above the glass, 143% just below */
@keyframes cr-roll {
  to { background-position: 0 0, 0 143%; }
}
/* A dip in brightness with a sync slip: a jerk sideways and a fading sway */
@keyframes cr-flicker {
  0%, 100% { opacity: 1; transform: none; }
  50% { opacity: 0.92; transform: none; }
  53% { opacity: 0.75; transform: translateX(0.03em); }
  55% { transform: translateX(-0.015em); }
  57% { opacity: 0.95; transform: translateX(0.006em); }
  59% { transform: none; }
}
@property --cr-t {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@keyframes cr-clock {
  to { --cr-t: 1; }
}

/* Less motion: the screen just glows behind its glass โ€” no flicker, no power-off. */
@media (prefers-reduced-motion: reduce) {
  .cr-crt,
  .cr-crt > *,
  .cr-crt::after { animation: none; }
}