Skip to content

Colour-shifting letters on hover in WordPress

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.

Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in WordPress

effet-texte-degrade-survol-lettres.php
<?php
/**
 * Plugin Name: Forge, Lettres colorées au survol
 * Description: Un grand titre dont chaque lettre se colore et se soulève en cascade quand on survole la carte ou qu’on y entre au clavier, en CSS pur. Ajoute la composition « Lettres colorées au survol » à l'éditeur de blocs.
 * Version: 1.0.0
 * Requires at least: 6.6
 * Requires PHP: 8.1
 * Author: Forge
 * License: GPL-2.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: forge-effet-texte-degrade-survol-lettres
 *
pattern.html
<!-- wp:group {"tagName": "article", "className": "efls", "layout": {"type": "default"}} -->
<article class="wp-block-group efls"><!-- wp:paragraph {"className": "efls__eyebrow"} -->
<p class="efls__eyebrow">Atelier Terre Vive · Portes ouvertes</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level": 2, "className": "efls__title"} -->
<h2 class="wp-block-heading efls__title"><span class="efls__sr">Venez toucher la terre</span>
          <span class="efls__letters" aria-hidden="true"><span class="efls__word"><span class="efls__l efls__l--1" style="--efls-i: 0">V</span><span class="efls__l efls__l--2" style="--efls-i: 1">e</span><span class="efls__l efls__l--3" style="--efls-i: 2">n</span><span class="efls__l efls__l--4" style="--efls-i: 3">e</span><span class="efls__l efls__l--5" style="--efls-i: 4">z</span></span> <span class="efls__word"><span class="efls__l efls__l--1" style="--efls-i: 5">t</span><span class="efls__l efls__l--2" style="--efls-i: 6">o</span><span class="efls__l efls__l--3" style="--efls-i: 7">u</span><span class="efls__l efls__l--4" style="--efls-i: 8">c</span><span class="efls__l efls__l--5" style="--efls-i: 9">h</span><span class="efls__l efls__l--1" style="--efls-i: 10">e</span><span class="efls__l efls__l--2" style="--efls-i: 11">r</span></span> <span class="efls__word"><span class="efls__l efls__l--3" style="--efls-i: 12">l</span><span class="efls__l efls__l--4" style="--efls-i: 13">a</span></span> <span class="efls__word"><span class="efls__l efls__l--5" style="--efls-i: 14">t</span><span class="efls__l efls__l--1" style="--efls-i: 15">e</span><span class="efls__l efls__l--2" style="--efls-i: 16">r</span><span class="efls__l efls__l--3" style="--efls-i: 17">r</span><span class="efls__l efls__l--4" style="--efls-i: 18">e</span></span></span></h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"className": "efls__text"} -->
<p class="efls__text">Samedi 6 décembre, de 10 h à 18 h : démonstrations au tour, émaillage en direct et petites pièces à modeler pour les enfants. Entrée libre, 14 rue des Potiers à Nantes.</p>
<!-- /wp:paragraph -->
<!-- wp:html -->
style.css
:root {
  --efls-card: #ffffff;
  --efls-ink: #1f1a17;
  --efls-body: #4b4540;
  --efls-accent: #c2410c;
  --efls-c1: #c2410c;
  --efls-c2: #be123c;
  --efls-c3: #6d28d9;
  --efls-c4: #0f766e;
  --efls-c5: #1d4ed8;
  --efls-lift: -0.14em;
  --efls-speed: 0.45s;

Free component: copy it freely, including for commercial projects.

Visual effects components in WordPress
  • 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
  • A paragraph whose words turn from grey to full ink, one by one, as the page scrolls, in pure CSS with a plain-text fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four offset, translucent sine waves gently roll along the bottom of a section, each at its own pace.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component