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

147
Vistas
How to target the svg-element created by a Lottie animation?

I'm trying to target the svg-element that's created by my lottie-animation with CSS to give it some border-radius. Being rather unexperienced with JavaScript and CSS, I couldn't figure out how to do it.

I've already tried targeting the svg-element as a child of the lottie-player-element by using:

lottie-player svg {
border-radius: 9px;
}

I assume this doesn't work, because the svg isn't present in the original HTML code and only added later through JavaScript. Is that correct?

Do you have any ideas how to give this animation rounded corners, ideally through CSS?

Here's a codepen to play around with: https://codepen.io/Kartenhouse/pen/JjpmXem

Thanks a lot for your help!

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

0

Try creating a parent div and do all CSS properties there instead to lottie player. Like what I have done. Codepen for reference

HTML : Parented the lottie player

<div id="lottie">
  <lottie-player src="https://assets5.lottiefiles.com/datafiles/zc3XRzudyWE36ZBJr7PIkkqq0PFIrIBgp4ojqShI/newAnimation.json" speed="1" loop autoplay>
  </lottie-player>
</div>

CSS : Added CSS to parent div instead of HTML.

#lottie {
  height: 300px;
  width: 300px;
  border: 2px solid red;
  border-radius: 12px;
  z-index: 12;
  background-color: #000000;
}

The final output looks like this

enter image description here

Note: If you need lottie controls then you need to write your own logic for player to start and stop animation.

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