Animate SVG illustrations with Lottie and JavaScript

Would you like to animate your illustrations without having images that are too heavy? Perhaps you'd even like to manage the speed? Then you've come to the right place! Find out how to animate SVG illustrations with Lottie!
•
Updated on August 14, 2026
•
2 min read
Believemy logo

Looking for a way to display your latest blog posts or your recent projects in a modern and animated manner? These cards will perfectly complement your website! Let’s discover how to create them.

 

Step 1

The HTML code.

HTML
<div class="cards">
  <a href="#" class="card">
    <div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1504109586057-7a2ae83d1338?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1490&q=80)"></div>
    <div class="card-content">
      <p>Travel</p>
      <h3>Japan</h3>
    </div>
  </a>

  <a href="#" class="card">
    <div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1593971657261-184f7a3a72de?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80)"></div>
    <div class="card-content">
      <p>Travel</p>
      <h3>United States</h3>
    </div>
  </a>

  <a href="#" class="card">
    <div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1532465614-6cc8d45f647f?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80)"></div>
    <div class="card-content">
      <p>Travel</p>
      <h3>France</h3>
    </div>
  </a>

  <a href="#" class="card">
    <div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1502003148287-a82ef80a6abc?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80)"></div>
    <div class="card-content">
      <p>Travel</p>
      <h3>Canada</h3>
    </div>
  </a>
</div>

 

Step 2

Let’s style the page and the section that groups the cards.

CSS
* {
  border: 0;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  padding: 50px;
  background: #131416;
}

.cards {
  margin: auto;
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  grid-gap: 24px;
  max-width: 1200px;
  width: 100%;
}

@media(min-width: 540px){
  .cards {
    grid-template-columns: repeat(2, 1fr); 
  }
}

@media(min-width: 960px){
  .cards {
    grid-template-columns: repeat(4, 1fr); 
  }
}

 

Step 3

Let’s create each card and the background one by one.

CSS
.card {
  position: relative;
  padding-bottom: 150%;
}

.card-background {
  background-size: cover;
  background-position: center;
  border-radius: 24px;
  filter: brightness(0.75) saturate(1.2) contrast(0.85);
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  transform-origin: center;
  transition: .2s;
}

 

Step 4

Let’s tackle the hover styles!

CSS
.card:hover .card-background {
  transform: scale(1.05) translateZ(0);
}

.cards:hover > .card:not(:hover) .card-background {
  filter: brightness(0.5) saturate(0) contrast(1.2) blur(20px);
}

 

Step 5

Let’s finish by styling the content of each card.

CSS
.card-content {
  padding: 24px;
  position: absolute;
  font-family: arial, sans-serif;
}

.card-content p {
  color: rgba(255, 255, 255, .6);
  font-size: .9rem;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.card-content h3 {
  color: rgba(255, 255, 255, .9);
  font-size: 1.9rem;
  text-shadow: 2px 2px 20px rgba(0,0,0,0.2);
}
Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Creating an animated list with CSS

Let's find out how to create an animated hover list!

December 9, 2024

Creating animated presentation cards with JavaScript

Whether you're presenting the team behind your project or anything else, using animated presentation cards will give your page a successful finishing touch. Find out how in this article!

December 9, 2024

Animate emojis like on Discord with JavaScript

Would you like to create a button whose emoji changes every time you move your mouse over it? Like on Discord? Then this article is for you!

December 9, 2024

Create a map displaying links on mouse-over with CSS

To present your team or simply yourself, this animation will allow you to display the links to your social networks when you hover over the map: a striking effect guaranteed! Let's find out how to do it together.

December 9, 2024

Create an animated gradient background on hover avec CSS

Whether it's to highlight a part of your website or a quote as in this example, generating and adding a gradient to the background can give your website a very modern touch. Find out in this article how to do it easily!

December 9, 2024

Make an arrow that expands when hovered over with CSS

Whether it's to make your users want to see your project, read your article or access a page on your website, presenting your link with an arrow will make it easier to catch your visitors' eye! Let's find out in this article how to animate this arrow to enhance your readers' experience.

December 9, 2024

Creating a cascading animation on text

For a slogan or for an animation on a very important page of your project, this very modern effect is also very easy to achieve. Let's take a look at how to do it in this article.

December 9, 2024

Creating a skeleton with JavaScript

Let's find out together how to create a loading effect on our elements during an AJAX call, for example!

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.