Solution 1 :

You can use display-grid to force the elements in a single row.

And you can play with the properties of the animation to get this effect, but the duration of the animation should be the same for all the elements; what is changing from one to the other is the delay , to make then be at different stages of the animation:

ul {
  list-style: none;
  width: 100%;
  position: relative;
  display: grid;
}

ul li {
  display: inline-block;
  width: 30%;
  opacity: 0.2;
  animation: fadeInSlow ease-in-out 6s infinite;
  background-color: blue;
  height: 50px;
  grid-row: 1;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  6% {
    opacity: 1;
  }
  27% {
    opacity: 1;
  }
  33% {
    opacity: 0;
  }
}

@keyframes fadeInSlow {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  21% {
    opacity: 1;
  }
  33%, 100% {
    opacity: 0;
  }
}

li:nth-child(4),
li:nth-child(5),
li:nth-child(6) {
  animation-delay: -4s;
}

li:nth-child(7),
li:nth-child(8),
li:nth-child(9) {
  animation-delay: -2s;
}

li:nth-child(3n+1) {
  grid-column: 1;
}

li:nth-child(3n+2) {
  grid-column: 2;
}

li:nth-child(3n+3) {
  grid-column: 3;
}
<div class="row--animated">
  <ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
    <li>6</li>
    <li>7</li>
    <li>8</li>
    <li>9</li>
  </ul>
</div>

Solution 2 :

Update: this snippet is what I think you want, note that I changed the HTML a bit so that I can manipulate the elements size and display, Implemented with CSS3 only, heavily inspire by this codepen:

.slider {
  width: 900px;
  margin: 0 auto;
}
.slide {
  position: absolute;
  display: grid;
  grid-template-columns: auto auto auto;
  grid-gap: 10px;
}

.slide img {
  width: 100;
  height: auto;
}

.slide1 {
  animation: fade 8s infinite;
  -webkit-animation: fade 8s infinite;
}
.slide2 {
  animation: fade2 8s infinite;
  -webkit-animation: fade2 8s infinite;
}
.slide3 {
  animation: fade3 8s infinite;
  -webkit-animation: fade3 8s infinite;
}
@keyframes fade {
  0% {
    opacity: 1;
  }
  33.333% {
    opacity: 0;
  }
  66.666% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@keyframes fade2 {
  0% {
    opacity: 0;
  }
  33.333% {
    opacity: 1;
  }
  66.666% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
@keyframes fade3 {
  0% {
    opacity: 0;
  }
  33.333% {
    opacity: 0;
  }
  66.666% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      <link rel="stylesheet" href="style.css">
  </head>
  <body>

    <div class='slider'>
      <div class='slide slide1'>
        <div class="container">
          <img src="//placehold.it/300x280?text=Image 1" />
        </div>
        <div class="container">
          <img src="//placehold.it/300x280?text=Image 2" />
        </div>
        <div class="container">
          <img src="//placehold.it/300x280?text=Image 3" />
        </div>
      </div>
      <div class='slide slide2'>
        <div class="container">
          <img src="//placehold.it/300x280?text=Image 4" />
        </div>
        <div class="container">
          <img src="//placehold.it/300x280?text=Image 5" />
        </div>
        <div class="container">
          <img src="//placehold.it/300x280?text=Image 6" />
        </div>
      </div>
      <div class='slide slide3'>
        <div class="container">
          <img src="//placehold.it/300x280?text=Image 7" />
        </div>
        <div class="container">
          <img src="//placehold.it/300x280?text=Image 8" />
        </div>
        <div class="container">
          <img src="//placehold.it/300x280?text=Image 9" />
        </div>
      </div>
    </div>

</body>

</html>

Problem :

I have 9 logos as of now and that logo I am displaying in the list order. Now what I am doing is, I have to display the first 3 logos and wait for some second then hide that 3 logos and display the next 3 logos again wait for some second, and display the next 3 logos. I need infinite this.

For example:

On the page load display first 3 logo

1 2 3

//wait for the second

1 2 3   // hide this
4 5 6   // display this
7 8 9   // hide this

//wait for second  
1 2 3   // hide this
4 5 6   // hide this
7 8 9   // display this

// wait for second
1 2 3   // display this
4 5 6   // hide this
7 8 9   // hide this

I need infinite.

I tried this code but it’s not working.

ul {
  list-style: none;
  width: 100%;
  position: relative;
}

ul li {
  display: inline-block;
  width: 33%;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
  opacity: 0;
  animation-name: fadeIn;
}

ul li img {
  width: 250px;
}


/*Animated Logos*/

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  6% {
    opacity: 1;
  }
  27% {
    opacity: 1;
  }
  33% {
    opacity: 0;
  }
}

.row--animated li:nth-of-type(-n+3) {
  animation-duration: 4s;
}

.row--animated li:nth-child(4),
.row--animated li:nth-child(5),
.row--animated li:nth-child(6) {
  animation-duration: 6s;
}

.row--animated li:nth-last-child(-n+3) {
  animation-duration: 8s;
  /*position: absolute;*/
}
<div class="row--animated">
  <ul>
    <li><img src="//placehold.it/450x280?text=Image 1" /></li>
    <li><img src="//placehold.it/450x280?text=Image 2" /></li>
    <li><img src="//placehold.it/450x280?text=Image 3" /></li>
    <li><img src="//placehold.it/450x280?text=Image 4" /></li>
    <li><img src="//placehold.it/450x280?text=Image 5" /></li>
    <li><img src="//placehold.it/450x280?text=Image 6" /></li>
    <li><img src="//placehold.it/450x280?text=Image 7" /></li>
    <li><img src="//placehold.it/450x280?text=Image 8" /></li>
    <li><img src="//placehold.it/450x280?text=Image 9" /></li>
  </ul>
</div>

Would you help me out in this?

Comments

Comment posted by ROOT

are you looking for CSS only solution? is ok to have javascript/jQuery?

Comment posted by Naren Verma

@ROOT, Can you help me with jQuery?

Comment posted by ROOT

Yes, sure I will check it now.

Comment posted by ROOT

@Neren, sorry my friend I have something urgent, I can’t work on it if its not urgent thing for I will have a look at it later.

Comment posted by Naren Verma

@ROOT, No problem, I’ll wait for your reply. Stay safe stay healthy.

Comment posted by Naren Verma

How can I manage the speed of fadein? Now it’s running very fast

Comment posted by vals

Change the percentages in the keyframes. I have added another keyframes set that fades slower

Comment posted by prnt.sc/se73v6

Apologies for the late reply, I checked your updated answer. It’s almost working till 9 but after 9 when it starts from 1 then I am getting some white bg or light opacity. You can check this image

Comment posted by vals

I believe it’s solved now. I have added a keyframe for the 100% position

Comment posted by Naren Verma

Yes, It’s working perflect. Thanks for the help. Upvote from my side

Comment posted by Naren Verma

Thanks for the answer. I checked the snippet. It’s working. Is it possible to display all the logos in the same place? I mean now it is displaying below. I tried position: absolute; to the li but it’s not working.

Comment posted by ROOT

yes, we can use

Comment posted by ROOT

@NarenVerma, this is a bit tricky one, I just want to ask if you want something like this then why not using a slider library?

Comment posted by ROOT

@NarenVerma, I was able to achieve that using CSS only check it out, but I really recommend using a CSS slider library.

Comment posted by Naren Verma

Hi @ROOT, Your answer is also working but I found the best answer from vals. Upvote from my side.

By

Leave a Reply

Your email address will not be published. Required fields are marked *