Qu'est-ce qu'un bon effet au survol, et fonctionne-t-il sur mobile ?

Un effet au survol donne un retour immédiat quand le pointeur atteint un élément : agrandissement, changement de couleur, soulignement, reflet ou révélation. Il se construit avec des transitions CSS sur :hover et :focus-visible, des pseudo-éléments pour les soulignements et les reflets, et un peu de JavaScript pour la physique ou l'inclinaison 3D qui suit le pointeur.

Comment choisir, performances et accessibilité
  • Choisissez des effets sobres comme Underline Expand, Color Shift ou Scale & Rotate pour la navigation et les cartes, et des effets ludiques comme Like Heart, Paint Brush ou Gravity Simulation pour les moments de surprise.
  • Les écrans tactiles n'ont pas de survol : placez les styles de survol dans @media (hover: hover), ne cachez jamais une information essentielle derrière un survol et reproduisez chaque effet au focus clavier.
  • Scale & Rotate, Background Slide, Like Heart, Paint Brush et Gravity Simulation sont gratuits avec leur code complet ; les autres sont inclus dans Premium.

Scale & Rotate

Agrandissement avec légère rotation.

CSS Transform
Page de l’effet →
Voir le code source
HTML
<div class="fx-0343-root">
  <button class="hover-box hover-scale-rotate" type="button">
    <span>Scale &amp; Rotate</span>
  </button>
</div>
CSS
.fx-0343-root,
.fx-0343-root *,
.fx-0343-root *::before,
.fx-0343-root *::after {
  box-sizing: border-box
}

.fx-0343-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
  background: rgb(26, 26, 36);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

/* Variables du design system du site, dont ce code dépend (valeurs de css/style.css — à adapter librement). */
.fx-0343-root {
  --bg-card: #12121a;
  --border: rgba(255, 255, 255, 0.08);
  --radius-xl: 1rem;
}

.fx-0343-root .hover-box {
  width: 200px;
  height: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.fx-0343-root .hover-scale-rotate {
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fx-0343-root .hover-scale-rotate:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.3);
}

.fx-0343-root .hover-scale-rotate:focus-visible {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.3);
  outline: 2px solid #6366f1;
  outline-offset: 3px;
}

.fx-0343-root .hover-box span {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .fx-0343-root * {
    transition: none !important;
    animation-play-state: paused !important;
  }

  .fx-0343-root .hover-scale-rotate:hover,
  .fx-0343-root .hover-scale-rotate:focus-visible {
    transform: none;
  }
}
JavaScript
/* CSS pur — aucun JavaScript requis */

Background Slide

Le fond glisse de gauche à droite.

CSS Background
Page de l’effet →
Voir le code source
HTML
<div class="fx-0344-root">
  <button class="hover-box hover-bg-slide" type="button">
    <span>BG Slide</span>
  </button>
</div>
CSS
.fx-0344-root,
.fx-0344-root *,
.fx-0344-root *::before,
.fx-0344-root *::after {
  box-sizing: border-box
}

.fx-0344-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
  background: rgb(26, 26, 36);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

/* Variables du design system du site, dont ce code dépend (valeurs de css/style.css — à adapter librement). */
.fx-0344-root {
  --bg-card: #12121a;
  --border: rgba(255, 255, 255, 0.08);
  --radius-xl: 1rem;
}

.fx-0344-root .hover-box {
  width: 200px;
  height: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.fx-0344-root .hover-bg-slide {
  background: linear-gradient(90deg, var(--bg-card) 50%, #6366f1 50%);
  background-size: 200% 100%;
  background-position: left;
  transition: all 0.5s ease;
}

.fx-0344-root .hover-bg-slide:hover {
  background-position: right;
  color: white;
}

.fx-0344-root .hover-bg-slide:focus-visible {
  background-position: right;
  color: white;
  outline: 2px solid #6366f1;
  outline-offset: 3px;
}

.fx-0344-root .hover-box span {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .fx-0344-root * {
    transition: none !important;
    animation-play-state: paused !important;
  }
}
JavaScript
/* CSS pur — aucun JavaScript requis */

Border Gradient

Bordure gradient qui apparaît au survol.

CSS Border

Shine Effect

Reflet lumineux qui traverse l'élément.

CSS Light

Underline Expand

Ligne qui s'étend depuis le centre.

CSS Line

Icon Bounce

L'icône rebondit au survol.

CSS Animation

Color Shift

Transition de couleur fluide.

CSS Color

Blur Reveal

L'élément flou devient net au survol.

CSS Filter

Shadow Inset

Ombre intérieure lumineuse.

CSS Shadow

Tilt 3D

Inclinaison perspective au survol.

CSS 3D

Shutter Reveal

Effet volets qui s'ouvrent au survol.

CSS Reveal

Glitch Hover

Effet glitch RGB au survol.

CSS Glitch

Fill Up

Remplissage de bas en haut avec une courbe ease-quart.

CSS Fill Bezier

Filter Animated

Au survol, les teintes de l'élément tournent en continu (filtres CSS).

CSS Filter GPU

Spotlight Effect

Effet projecteur qui suit le curseur sur l'élément.

JS Mouse Light

Magnetic Pull

L'élément est attiré par le curseur avec effet magnétique.

JS Mouse Physics

Elastic Scale

Agrandissement avec courbe élastique et rebond naturel.

CSS Bezier Scale

Gradient Shift

Gradient animé qui accélère au survol pour un effet dynamique.

CSS Gradient Animation
423 likes

Like Heart

Bouton like avec animation pop, anneau de propagation et explosion de particules colorées au clic.

CSS Animation Interactive
Page de l’effet →
Voir le code source
HTML
<div class="fx-0361-root">
  <div class="mi-heart-scene">
    <button class="mi-heart-btn" aria-pressed="false" aria-label="Aimer">
      <svg viewBox="0 0 24 24"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>
      <div class="mi-heart-particles">
        <span class="mi-heart-particle"></span>
        <span class="mi-heart-particle"></span>
        <span class="mi-heart-particle"></span>
        <span class="mi-heart-particle"></span>
        <span class="mi-heart-particle"></span>
        <span class="mi-heart-particle"></span>
        <span class="mi-heart-particle"></span>
        <span class="mi-heart-particle"></span>
      </div>
    </button>
    <span class="mi-heart-count">423 likes</span>
  </div>
</div>
CSS
.fx-0361-root,
.fx-0361-root *,
.fx-0361-root *::before,
.fx-0361-root *::after {
  box-sizing: border-box
}

.fx-0361-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
  background: rgb(26, 26, 36);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

.mi-heart-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.mi-heart-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.mi-heart-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.mi-heart-btn:focus-visible {
  outline: 2px solid #a5b4fc;
  outline-offset: 3px;
}

.mi-heart-btn svg {
  width: 36px;
  height: 36px;
  stroke: rgba(255, 255, 255, 0.5);
  fill: none;
  stroke-width: 2;
  transition: stroke 0.3s ease, fill 0.3s ease;
}

.mi-heart-btn.liked svg {
  stroke: #ef4444;
  fill: #ef4444;
  animation: miHeartPop 0.4s cubic-bezier(0.17, 0.89, 0.32, 1.49);
}

.mi-heart-btn.liked::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid #ef4444;
  animation: miHeartRing 0.6s ease-out forwards;
}

.mi-heart-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mi-heart-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  opacity: 0;
}

.mi-heart-btn.liked .mi-heart-particle {
  animation: miParticleBurst 0.6s ease-out forwards;
}

.mi-heart-particle:nth-child(1) { background: #ef4444; --angle: 0deg; }
.mi-heart-particle:nth-child(2) { background: #f97316; --angle: 45deg; }
.mi-heart-particle:nth-child(3) { background: #eab308; --angle: 90deg; }
.mi-heart-particle:nth-child(4) { background: #ef4444; --angle: 135deg; }
.mi-heart-particle:nth-child(5) { background: #ec4899; --angle: 180deg; }
.mi-heart-particle:nth-child(6) { background: #f97316; --angle: 225deg; }
.mi-heart-particle:nth-child(7) { background: #eab308; --angle: 270deg; }
.mi-heart-particle:nth-child(8) { background: #ec4899; --angle: 315deg; }

.mi-heart-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.3s ease;
}

.mi-heart-btn.liked ~ .mi-heart-count {
  color: #ef4444;
}

@keyframes miHeartPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes miHeartRing {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes miParticleBurst {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-40px); }
}

@media (prefers-reduced-motion: reduce) {
  .mi-heart-btn { transition: background-color 0.15s, border-color 0.15s; }
  .mi-heart-btn svg { transition: stroke 0.15s, fill 0.15s; }
  .mi-heart-btn.liked svg { animation: none; }
  .mi-heart-btn.liked::after { animation: none; opacity: 0; }
  .mi-heart-btn.liked .mi-heart-particle { animation: none; }
}
JavaScript
!function(){document.querySelectorAll('.fx-0361-root').forEach(function(root){var btn=root.querySelector('.mi-heart-btn');if(!btn)return;btn.addEventListener('click',function(){var liked=btn.classList.toggle('liked');btn.setAttribute('aria-pressed',liked?'true':'false');});})}();

Bookmark Toggle

Bouton de sauvegarde avec animation de chute, remplissage du fond et transition de couleur.

CSS Toggle Animation

Submit Button

Bouton envoi avec morphing circulaire, spinner de chargement et animation de check de succès.

CSS JS States

Ripple Click

Effet Material Design ripple au clic. L'onde se propage depuis le point de contact et s'estompe.

CSS JS Material

Pull to Refresh

Tirer pour rafraîchir : on tire la liste vers le bas (doigt ou souris), l'indicateur tourne puis le contenu se recharge.

CSS JS Mobile

Notification Bell

Cloche avec animation de vibration, badge compteur avec pop-in et toast de notification glissant.

CSS JS Notification

Star Rating

Système de notation avec animation pop et rotation sur chaque étoile. Labels dynamiques selon la note.

CSS JS Rating

Switch with Icons

Interrupteurs avec icônes intégrées dans la poignée, animation bounce et changement de couleur.

CSS Toggle Icons

Copy to Clipboard

Bouton copier avec transition d'icônes (copie → check), couleur de succès et tooltip « Copié ».

CSS JS Clipboard

Confetti Button

Bouton qui déclenche une pluie de confettis colorés avec gravité et rotation réalistes.

JS Canvas Animation

Paint Brush

Pinceau lumineux qui laisse une traînée colorée.

Canvas Draw Creative
Page de l’effet →
Voir le code source
HTML
<div class="fx-0371-root">
  <canvas class="pb-canvas" aria-label="Zone de dessin"></canvas>
  <span class="pb-label" aria-hidden="true">Dessinez avec la souris ou le doigt</span>
</div>
CSS
.fx-0371-root,.fx-0371-root *,.fx-0371-root *::before,.fx-0371-root *::after{box-sizing:border-box}
.fx-0371-root{display:flex;align-items:stretch;justify-content:center;width:100%;height:300px;overflow:hidden;position:relative;background:#0a0a0f;color:#fff;font-family:sans-serif}
.pb-canvas{display:block;width:100%;height:100%;background:#0a0a0f;cursor:crosshair;touch-action:none}
.pb-label{position:absolute;bottom:10px;left:50%;transform:translateX(-50%);font-size:.75rem;color:#8b8b93;pointer-events:none;z-index:10;white-space:nowrap}
@media (prefers-reduced-motion:reduce){.fx-0371-root .pb-canvas{cursor:default}}
JavaScript
(function(){
  var reduceMotion=window.matchMedia('(prefers-reduced-motion:reduce)').matches;
  document.querySelectorAll('.fx-0371-root').forEach(function(root){
    var canvas=root.querySelector('.pb-canvas');
    if(!canvas)return;
    var ctx=canvas.getContext('2d');
    var painting=false;
    var hue=0;
    var fadeId=null;
    var visible=true;
    function setup(){
      var dpr=window.devicePixelRatio||1;
      var w=canvas.clientWidth;
      var h=canvas.clientHeight;
      canvas.width=Math.round(w*dpr);
      canvas.height=Math.round(h*dpr);
      ctx.setTransform(dpr,0,0,dpr,0,0);
      ctx.fillStyle='#0a0a0f';
      ctx.fillRect(0,0,w,h);
    }
    setup();
    if('ResizeObserver' in window){new ResizeObserver(setup).observe(canvas);}
    function getPos(e){
      var rect=canvas.getBoundingClientRect();
      var src=e.touches?e.touches[0]:e;
      return{x:src.clientX-rect.left,y:src.clientY-rect.top};
    }
    function draw(e){
      if(!painting)return;
      var p=getPos(e);
      ctx.beginPath();
      ctx.arc(p.x,p.y,15,0,Math.PI*2);
      ctx.fillStyle='hsl('+hue+',70%,60%)';
      ctx.fill();
      hue=(hue+2)%360;
    }
    canvas.addEventListener('mousedown',function(){painting=true;});
    canvas.addEventListener('mouseup',function(){painting=false;});
    canvas.addEventListener('mouseleave',function(){painting=false;});
    canvas.addEventListener('mousemove',draw);
    canvas.addEventListener('touchstart',function(e){e.preventDefault();painting=true;},{passive:false});
    canvas.addEventListener('touchend',function(){painting=false;});
    canvas.addEventListener('touchmove',function(e){e.preventDefault();draw(e);},{passive:false});
    if(!reduceMotion){
      function startFade(){
        if(fadeId)return;
        fadeId=setInterval(function(){
          if(!visible){clearInterval(fadeId);fadeId=null;return;}
          ctx.fillStyle='rgba(10,10,15,.02)';
          var dpr=window.devicePixelRatio||1;
          ctx.fillRect(0,0,canvas.width/dpr,canvas.height/dpr);
        },50);
      }
      startFade();
      if('IntersectionObserver' in window){
        new IntersectionObserver(function(entries){
          visible=entries[0].isIntersecting;
          if(visible&&!fadeId)startFade();
          if(!visible&&fadeId){clearInterval(fadeId);fadeId=null;}
        }).observe(canvas);
      }
    }
  });
})();

Repel Particles

Particules qui fuient le curseur.

JS Particles Physics

Text Scramble

Texte qui se décode au survol.

JS Text Decode

Elastic Drag

Élément draggable avec retour élastique.

JS Drag Spring

Scratch Reveal

Grattez pour révéler le contenu caché.

Canvas Reveal Game

Morph on Click

Forme qui se transforme à chaque clic.

CSS JS Transform

Live Typing

Cliquez puis tapez : chaque caractère apparaît avec une animation.

JS Keyboard Animation

Sound Visualizer

Visualiseur de son en temps réel : 20 barres de fréquences, sur une démo intégrée, votre lecteur audio ou le micro.

JS Audio Visual

Magnetic Letters

Lettres attirées par le curseur ; un clic inverse en répulsion. Elles reviennent en place avec un ressort.

JS Physics Text

Gravity Drag

Éléments qui tombent avec gravité une fois relâchés.

JS Physics Drag
Cliquez pour ajouter des balles

Gravity Simulation

Balles soumises à la gravité avec rebond.

JS Physics Interactive
Page de l’effet →
Voir le code source
HTML
<div class="fx-0381-root">
  <div class="gs381-container">
    <span class="gs381-label">Cliquez pour ajouter des balles</span>
  </div>
</div>
CSS
.fx-0381-root,.fx-0381-root *,.fx-0381-root *::before,.fx-0381-root *::after{box-sizing:border-box}.fx-0381-root{--text-muted:#8b8b93;display:flex;align-items:center;justify-content:center;width:100%;height:250px;overflow:hidden;position:relative;background:rgb(26,26,36);color:rgb(255,255,255);font-family:sans-serif}.gs381-container{width:100%;height:250px;position:relative;overflow:hidden}.gs381-ball{position:absolute;width:30px;height:30px;border-radius:50%;cursor:pointer}.gs381-label{position:absolute;bottom:10px;left:50%;transform:translateX(-50%);font-size:.75rem;color:var(--text-muted);pointer-events:none;z-index:10;white-space:nowrap}
JavaScript
(function(){var pref=window.matchMedia('(prefers-reduced-motion: reduce)');document.querySelectorAll('.fx-0381-root').forEach(function(root){var container=root.querySelector('.gs381-container');if(!container)return;var balls=[];var gravity=.5,bounce=.7,friction=.99;var rafId=null,lastTs=0;container.addEventListener('click',function(e){var r=container.getBoundingClientRect();var ball=document.createElement('div');ball.className='gs381-ball';ball.style.background='hsl('+(Math.random()*360)+',70%,60%)';var x=e.clientX-r.left-15,y=e.clientY-r.top-15;ball.style.left=x+'px';ball.style.top=y+'px';container.appendChild(ball);balls.push({el:ball,x:x,y:y,vx:(Math.random()-.5)*10,vy:0});if(balls.length>20){var old=balls.shift();old.el.remove()}});container.addEventListener('touchstart',function(e){e.preventDefault();var r=container.getBoundingClientRect();var ball=document.createElement('div');ball.className='gs381-ball';ball.style.background='hsl('+(Math.random()*360)+',70%,60%)';var x=e.touches[0].clientX-r.left-15,y=e.touches[0].clientY-r.top-15;ball.style.left=x+'px';ball.style.top=y+'px';container.appendChild(ball);balls.push({el:ball,x:x,y:y,vx:(Math.random()-.5)*10,vy:0});if(balls.length>20){var old=balls.shift();old.el.remove()}},{passive:false});if(pref.matches)return;function loop(ts){var dt=lastTs>0?Math.min(ts-lastTs,50):16.67;var f=dt/16.67;lastTs=ts;var h=container.offsetHeight,w=container.offsetWidth;balls.forEach(function(b){b.vy+=gravity*f;b.vx*=Math.pow(friction,f);b.x+=b.vx*f;b.y+=b.vy*f;if(b.y>h-30){b.y=h-30;b.vy*=-bounce}if(b.x<0){b.x=0;b.vx*=-bounce}if(b.x>w-30){b.x=w-30;b.vx*=-bounce}b.el.style.left=b.x+'px';b.el.style.top=b.y+'px'});rafId=requestAnimationFrame(loop)}function start(){if(!rafId)rafId=requestAnimationFrame(loop)}function stop(){if(rafId){cancelAnimationFrame(rafId);rafId=null;lastTs=0}}new IntersectionObserver(function(en){en[0].isIntersecting?start():stop()}).observe(root);start()})})();

Elastic String

Corde élastique qui réagit au curseur.

JS Elastic Mouse

Magnetic Field

Particules attirées par un champ magnétique.

JS Magnetic Particles

Newton's Cradle Loop

Cinq pendules qui se balancent seuls et se relancent en boucle.

JS Pendulum Energy

Liquid Simulation

La souris repousse les gouttes : la nappe s'ouvre autour du curseur et ses bords fusionnent.

JS Fluid Metaball

Spring Physics

Animation élastique avec effet ressort.

JS Spring Bounce

Collision Detection

Balles qui rebondissent les unes sur les autres.

JS Collision Physics

Cloth Simulation

Simulation de tissu interactif.

Canvas Cloth Interactive

Interactive Newton's Cradle

Attrapez une bille et relâchez-la : le choc traverse la rangée (souris ou doigt).

Canvas Physics Momentum

Rope Physics

Corde interactive avec simulation physique.

Canvas Verlet Draggable

Fluid X-Ray Reveal

Le curseur « scanne » et révèle une couche cachée — ici, la même personne déguisée. Masque fluide à traînée. Avant/après, normal/déguisé, jour/nuit : la 2e couche peut être n'importe quoi.

💡 Idéal pour : avant/après, « voir le costume », teaser de soirée Halloween, comparaison de visuels, easter-egg de portrait.

CSS Mask Vanilla JS Hover Premium

Scratch Coupon Reveal

Carte à gratter qui dévoile un code promo, puis propose de le copier. Interaction tactile et ludique qui valorise l'offre. Code et seuil de révélation personnalisables.

💡 Idéal pour : code promo, jeu-concours, fidélité, Black Friday, pop-up d'offre, gamification e-commerce.

Canvas Scratch Coupon Premium

Gift Unwrap Reveal

Un cadeau qui tourne sur lui-même, dont le couvercle se soulève et d'où sort un code promo (ou tout contenu) en rebond, avec étincelles. Idéal pour dévoiler une offre de fête de façon mémorable. Code personnalisable.

💡 Idéal pour : code promo de Noël, révélation d'offre, jeu-concours, message de vœux, calendrier surprise, e-commerce festif.

Vanilla JS Reveal Festif Gratuit
Voir le code source
HTML
<div class="fx-0812-root">
  <div class="guw-scene" data-guw data-code="NOEL30">
    <button type="button" class="guw-gift" data-guw-box aria-label="Ouvrir le cadeau">
      <span class="guw-inner" aria-hidden="true">
        <span class="guw-code" data-guw-code>🎄 NOEL30</span>
        <span class="guw-box"></span>
        <span class="guw-lid"></span>
        <span class="guw-bow">🎀</span>
      </span>
    </button>
    <div class="guw-hint" aria-hidden="true">Clique pour déballer</div>
  </div>
</div>
CSS
.fx-0812-root,
.fx-0812-root *,
.fx-0812-root *::before,
.fx-0812-root *::after {
  box-sizing: border-box
}

.fx-0812-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
  position: relative;
  background: rgb(26, 26, 36);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

.guw-scene {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 330px;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #241433, #0b0a14 72%);
}

.guw-gift {
  position: relative;
  width: 220px;
  height: 250px;
  border: 0;
  background: none;
  cursor: pointer;
  outline-offset: 8px;
}

.guw-gift:focus-visible {
  outline: 2px solid #fb7185;
  border-radius: 12px;
}

.guw-code {
  position: absolute;
  left: 50%;
  bottom: 58px;
  transform: translateX(-50%) translateY(0) scale(.6);
  z-index: 3;
  background: linear-gradient(135deg, #ffe08a, #f2a900);
  color: #5b3a00;
  font-weight: 800;
  letter-spacing: .06em;
  font-size: 16px;
  padding: 9px 16px;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .4);
  border: 2px dashed #b97e00;
  transition: transform .55s cubic-bezier(.2, 1.55, .35, 1);
  transition-delay: 0s;
}

.guw-box {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  width: 140px;
  height: 96px;
  border-radius: 9px;
  z-index: 4;
  background: linear-gradient(135deg, #e01e37, #9c0f20);
  box-shadow: inset 0 -10px 16px rgba(0, 0, 0, .32), 0 14px 22px rgba(0, 0, 0, .4);
}

.guw-box::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 24px;
  height: 100%;
  background: linear-gradient(#ffd166, #f2a900);
}

.guw-box::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100%;
  height: 24px;
  background: linear-gradient(90deg, #f2a900, #ffd166);
}

.guw-lid {
  position: absolute;
  left: 50%;
  bottom: 124px;
  transform: translateX(-50%) translateY(0) rotate(0);
  width: 162px;
  height: 40px;
  border-radius: 9px;
  z-index: 6;
  background: linear-gradient(135deg, #f0263f, #b01225);
  box-shadow: 0 6px 12px rgba(0, 0, 0, .35);
  transition: transform .5s cubic-bezier(.34, 1.3, .5, 1);
  transition-delay: .55s;
}

.guw-lid::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 24px;
  height: 100%;
  background: linear-gradient(#ffd166, #f2a900);
}

.guw-bow {
  position: absolute;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%) translateY(0);
  font-size: 40px;
  z-index: 7;
  transition: transform .5s cubic-bezier(.34, 1.3, .5, 1);
  transition-delay: .55s;
}

.guw-inner {
  position: absolute;
  inset: 0;
  transform-origin: 50% 70%;
  transition: transform .75s cubic-bezier(.45, .05, .2, 1);
  transition-delay: .9s;
}

.guw-gift.guw-open .guw-inner {
  transform: rotate(360deg);
  transition-delay: 0s;
}

.guw-gift.guw-open .guw-lid {
  transform: translateX(-50%) translateY(-86px) rotate(-10deg);
  transition-delay: .78s;
}

.guw-gift.guw-open .guw-bow {
  transform: translateX(-50%) translateY(-104px) rotate(28deg);
  transition-delay: .78s;
}

.guw-gift.guw-open .guw-code {
  transform: translateX(-50%) translateY(-104px) scale(1);
  transition-delay: 1s;
}

.guw-spark {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffd166;
  z-index: 8;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: guw-spark .75s ease-out forwards;
}

.guw-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #fb7185;
  opacity: .6;
  pointer-events: none;
  transition: opacity .3s;
}

.guw-scene.guw-done .guw-hint {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {

  .guw-inner,
  .guw-lid,
  .guw-bow,
  .guw-code {
    transition: none !important;
  }
}

@keyframes guw-spark {
  to {
    transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(.2);
    opacity: 0;
  }
}
JavaScript
(function() {
  /* Sprint décembre 2026 — Noël — Gift Unwrap Reveal (fx-0812) */
  (function() {
    var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;

    document.querySelectorAll('[data-guw]').forEach(function(scene) {
      var gift = scene.querySelector('[data-guw-box]');
      var code = scene.querySelector('[data-guw-code]');
      if (scene.dataset.code) code.textContent = '🎄 ' + scene.dataset.code;
      var open = false;

      function burst() {
        if (reduceMotion) return;
        for (var i = 0; i < 12; i++) {
          var s = document.createElement('span');
          s.className = 'guw-spark';
          s.style.left = '50%';
          s.style.bottom = '150px';
          var a = (i / 12) * 6.2832 + Math.random() * 0.4,
            d = 50 + Math.random() * 50;
          s.style.setProperty('--dx', Math.cos(a) * d + 'px');
          s.style.setProperty('--dy', -Math.abs(Math.sin(a) * d) - 10 + 'px');
          gift.appendChild(s);
          (function(el) {
            setTimeout(function() {
              el.remove();
            }, 800);
          })(s);
        }
      }

      function toggle() {
        open = !open;
        gift.classList.toggle('guw-open', open);
        scene.classList.toggle('guw-done', open);
        gift.setAttribute('aria-label', open ? 'Cadeau ouvert (cliquer pour ré-emballer)' : 'Ouvrir le cadeau');
        if (open) setTimeout(burst, reduceMotion ? 0 : 1100);
      }
      gift.addEventListener('click', toggle);
      gift.addEventListener('keydown', function(e) {
        if (e.key === 'Enter' || e.key === ' ') {
          e.preventDefault();
          toggle();
        }
      });
    });
  })();
})();

Questions fréquentes

Quel est le meilleur effet hover pour une carte ? +

Le lift effect (translateY(-8px) + box-shadow) est le plus populaire et le plus efficace. Il crée une sensation de profondeur sans être distrayant. Ajoutez une transition de border-color pour renforcer le feedback visuel.

Comment créer un underline animé au hover ? +

Utilisez un pseudo-élément ::after avec position:absolute, bottom:0, height:2px, et width:0. Au hover, animez width vers 100%. Pour un effet depuis le centre : left:50%, transform:translateX(-50%), animez width.

Comment faire un effet tilt 3D au hover ? +

Écoutez mousemove sur la carte. Calculez la position du curseur relative au centre. Appliquez transform: perspective(1000px) rotateX(Xdeg) rotateY(Ydeg) avec les angles calcules. Ajoutez une transition pour la fluidité.

Les effets hover fonctionnent-ils sur mobile ? +

Non — il n'y a pas de hover sur tactile. Utilisez @media (hover: hover) pour cibler uniquement les appareils avec pointeur. Sur mobile, remplacez par des effets au clic/tap avec :active ou JavaScript.

Comment animer le hover d'une image ? +

Les effets les plus populaires : zoom (transform: scale(1.1) dans un overflow:hidden), overlay qui apparait (pseudo-élément avec opacity), filtre (grayscale vers couleur), et clip-path qui révèle du contenu caché.