Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

98
Vistas
3d tranforming/animating individual characters/words in a paragraph

I would like to animate portions of a paragraph. If I transform my p tag it transforms the entire box.

I've seen this done before and I'm kicking myself for not saving the stackoverflow answer to it, and now I've been searching for an answer for over an hour and can't seem to find it or any way to solve it.

Basically, I'd like the letters that the cursor hover over to pop out from the text some. I thought this could be done with CSS but javascript is welcome as well.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use JavaScript to wrap each letter in a span, then apply your styling when span:hover. The JavaScript below does this for each letter that isn't a space.

var text = document.getElementById('jump').innerHTML;
var result = '';
for (var i = 0; i < text.length; i++) {
    var char = text.substring(i, i + 1);
    if (char == ' ') {
        result += char;    
    } else {
        result += '<span>' + char + '</span>';
    }
    
}
document.getElementById('jump').innerHTML = result;
p#jump {
    line-height: 30px;

}
#jump span:hover {
    display: inline-block;
    transform: translateY(-10px);
}
<p id="jump">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda