Skip to content

Colour-shifting letters on hover

A large heading whose letters take on colour and lift one after another when the card is hovered or entered with the keyboard, in pure CSS.

  • Tailwind
  • React
  • CSS
  • WordPress
Open in a new tab

Description

At rest the heading is a single dark ink. When the card is hovered, or as soon as keyboard focus reaches its link, each letter slides to its colour (orange, raspberry, violet, teal, blue) and lifts slightly with a small bounce, one after another thanks to a delay computed from its position. The colour comes from a two-tone gradient clipped to the letter with background-clip, and only background-position and transform are animated, with no script or image. The real heading remains an h2 read in one piece: the split letters are hidden from screen readers, and every colour keeps AA contrast on the card in light and dark mode. The variables at the top of the file set the palette, lift height, duration and delay between letters. With prefers-reduced-motion nothing moves: the heading simply shows its colours. In forced colours mode it uses the system text colour. Example: the open day of a pottery studio in Nantes.

Code

Loading the code…

The code of this component in

Archive contents

effet-texte-degrade-survol-lettres-html-tailwind.zip3 files · 4 Ko

  • index.html14 Ko
  • README.md4 Ko
  • LICENSE.md1 Ko

Tags

Updated on December 2, 2026.

Reviews

No reviews yet.

In the same spirit

  • Cards that fade in as they enter the screen, one after another in each row, without a line of JavaScript and with a static fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A translucent card with a saturated blur whose sharper edge refracts the colourful shapes drifting behind it, with an opaque fallback when transparency is reduced.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A help block shaped like a conversation: bubbles, three animated typing dots and clickable quick replies that show your answers to frequent questions, frozen under prefers-reduced-motion.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component