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

300
Vistas
Is there a way to animate html elements inside a div to go inside another div and center themselves to it?

I'm working on a service section that works with tabs and has 2 components:

  1. Services tabs. Where I show each service with their respective title and description.

  2. Service Info. Where I show the full information for the selected service.

I've already made it work. If you click on a service (1) it will display the detailed info on the service info div (2). It works by creating the Service Info (2) beforehand and toggling display on and off using JS.

So far so good... But I don't want the Service Info to just show up; I want to make it so that when you click a service (1), then it's icon and title animate and position themselves just in the right position inside the Service Info container (2). So it looks more elegant than just showing up the info.

Example:

Example

I've already made some progress, but I'm afraid I'm not doing it right. Since I am using CSS transform: translate, and manually positioning the elements by moving them (x,y) px from their origin.

/* .TabNavItem represents a tab from Service Tabs (1)
And JS sets the .active class to the clicked tab */
.tabNavItem h3 {
  transition: ease-in-out 0.3s;
}

#tab1.active .serviceIconContainer {
  opacity: 0.2;
  transform: translate(0px, 260px);
}
#tab1.active h3 {
  transform: translate(315px, 130px) scale(1.5);
}

Is there any way to make the elements center themselves to the Service Info (2) div, instead of doing it manually with transform translate?

And is there any way to make the Service Tab (1), for the selected service, hide itself from the Tabs container without the elements inside it disappearing? That way, on the Tabs Container (1) it shows only the inactive services for you to click?

I tried doing:

.tabNavItem.active {
  visibility: hidden;
}

But the icon and h3 disappear too

Example:

Example of how it would look like after Service1 is selected

about 4 years ago · Juan Pablo Isaza
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