webdevpuneet.com

Neon Flicker Sign — CSS Glowing Text With Dying Tubes

Neon Flicker Sign · Text Animation · Plain HTML, CSS & JS · Live preview

Copy & paste

Source Code

<main class="wall">
  <div class="sign" id="sign">
    <p class="kicker">Diner &amp; Bar · Since 1987</p>
    <h1 class="neon pink" aria-label="Open">
      <span aria-hidden="true">O</span><span aria-hidden="true" class="flick">P</span><span aria-hidden="true">E</span><span aria-hidden="true" class="flick late">N</span>
    </h1>
    <p class="neon cyan sub">All night long</p>
  </div>
  <button type="button" class="power" id="power" aria-pressed="true">Cut the power</button>
</main>

Extend with AI

Take This Snippet Further With AI

Ask an AI coding assistant to explain why the flicker keyframes hold full opacity for most of the cycle and only dip in short bursts, instead of easing smoothly, and how giving the two failing letters different durations and delays stops the sign looking like a loop. A useful follow-up is how the power-on stagger is built from one CSS variable set in JavaScript, and whether it could be done with no JavaScript using sibling selectors.

Prompt to recreate it

Copy this into your AI assistant of choice to build the effect from scratch, or as a jumping-off point for your own variant:

text
Build a neon sign text effect in plain HTML, CSS and a little JavaScript, with no libraries.

Requirements:
- A sign panel on a dark brick-style background with a small kicker line, a large script-font word where every letter is its own span, and a smaller second neon line in a different colour.
- The glow is a stack of text-shadow layers: a tight white core, then wide coloured halos at roughly 10, 24, 48 and 90px, with the colour held in a CSS custom property so the sign can be recoloured in one place.
- Only some letters flicker. Give those a flicker keyframe animation that stays at full opacity for long stretches and drops to about 18% opacity with the shadow removed in short uneven bursts, and give a second flickering letter a different duration and a delay so the pattern never lines up.
- A "Cut the power" toggle button with aria-pressed. When off, every tube goes dark with no shadow. When switched back on, each letter plays a short stutter animation delayed by its index (set as a CSS variable from JavaScript), so the sign relights left to right.
- Put the word in a real heading with an aria-label and hide the decorative letter spans from assistive technology.
- Remove every animation under prefers-reduced-motion so the sign stays steadily lit.

Want to tighten it up first? Run this prompt through the AI Prompt Studio to score it across 8 quality dimensions, catch anti-patterns, and tune the wording for Claude, ChatGPT, or Gemini before you paste it in.

What's included

Features

Five-layer glow
A white core plus coloured halos at four radii give the hot-centre, soft-edge look of real glass tubing; one --glow variable recolours everything.
Per-letter failing tubes
Only letters marked flick stutter, each with its own duration and delay, so the pattern feels broken rather than looped.
Keyframes with long gaps
The animation is steady most of the time and drops out in short, uneven bursts, which is how a failing starter actually behaves.
Staggered power-on
Switching back on relights the letters left to right using an index variable and animation-delay, ending in the steady glow.
Accessible text
The word is in a real <h1> with an aria-label, the decorative letter spans are hidden from assistive tech, and the toggle exposes aria-pressed.
Respects reduced motion
With prefers-reduced-motion set, all flicker and relight animations are removed and the sign stays steadily lit.

About this UI Snippet

Neon Flicker Sign — Layered Text-Shadow Glow and Uneven Keyframe Flicker

Screenshot of the Neon Flicker Sign snippet rendered live

Glowing text is easy; believable neon is harder. A real tube sign doesn't pulse smoothly, it stutters: one letter drops out for a split second, comes back, drops again, and the rest of the sign stays steady. This snippet reproduces that with a diner-style "OPEN" sign where only two of the four letters misbehave, each on its own cycle length, so the pattern never looks like a loop.

The glow is five shadows deep

Each neon line stacks text-shadow layers from tight to wide: a 4px white core, then three to four coloured halos at 10, 24, 48 and 90px. The near-white core is what sells "hot tube"; the wide halos are what light up the brick wall around it. The colour lives in a --glow custom property, so recolouring the whole sign is one line.

Flicker is a keyframe with gaps, not a sine wave

The flicker keyframes sit at full brightness for long stretches and then drop to 18% opacity with the shadow stripped and the letter tinted a dead plum, in bursts at 18%, 21%, 24%, 53% and 55%. The second flickering letter reuses the keyframes but runs 5.2s with a 1.1s delay, so the two never line up.

Power off, power on

The button toggles an off class that kills every shadow, then a warming class on the way back, where each letter runs a one-shot strike animation delayed by its index (--i, set from JS), so the sign relights left to right like a real transformer warming up. Without JavaScript the sign still glows and flickers. Reduced-motion users get the steady, fully lit sign.

Step by step

How to Use

  1. 1
    Paste the three blocksA dark brick-wall scene renders a pink script "OPEN" with a cyan "All night long" line underneath and a pill button below. Two of the four letters already flicker on their own.
  2. 2
    Change the sign textEdit the letters inside the <h1> and keep each one in its own <span> so it can be lit independently. Update aria-label to the full word so screen readers read it as text rather than four letters.
  3. 3
    Pick which tubes failAdd the flick class to any letter you want to misbehave. Add late for the slower cycle with a delay. Letters without the class stay solid.
  4. 4
    Recolour the glowChange --glow on .neon.pink or .neon.cyan. Keep the text colour a pale tint of the same hue, since the near-white core is what makes the glow read as light.
  5. 5
    Tune the stutterIn the flicker keyframes, move the percentage stops to change when the dropouts happen, or add more. The animation duration sets how often the pattern repeats.

Real-world uses

Common Use Cases

Restaurant and bar homepages
An "OPEN" or venue-name sign over a dark hero sets the mood before any copy is read, and it costs nothing in images.
Event and nightlife landing pages
Gig posters, club nights and pop-ups can pair the flickering sign with a ticket button; the cyan sub line is a natural place for the date.
Retro and arcade-themed game menus
Use the sign as a title screen where one letter always seems about to die, with the power button as an easter egg.
404 and maintenance pages
A sign that reads "CLOSED" with one broken tube turns an error page into something memorable.
Portfolio section headings
A single neon word for a section title works well on dark portfolios when used once, not on every heading.

Got questions?

Frequently Asked Questions

One blur looks like a drop shadow. A tight white core plus several wider coloured halos imitates how light spreads from a glass tube: bright at the centre, fading in steps. Remove the outer two layers for a subtler sign.

Large blurs repaint when animated. Here only opacity animates for the flicker, and the colour change on dropout is instant, so it stays cheap. Avoid animating the blur radius itself.

Wrap each word instead of each letter in a span with the flick class. Whole-word dropouts read more like a failing sign than letter-by-letter noise does on long text.

Yes. Replace the font-family on .neon with a web font such as Monoton or Tilt Neon, and keep the same shadow stack. Thin-stroke fonts need less blur to stay readable.