Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!