CSS animation, FadeIn / FadeOut 2 images continuously

后端 未结 3 1668
北恋
北恋 2021-01-26 11:31

I have created sample CodePen here.

I tried below but didn\'t work.

 .elementToFadeInAndOut {
        width:200px;
        height: 200px;
        back         


        
3条回答
  •  悲哀的现实
    2021-01-26 12:02

    See below. I added a background color to the third image to make it visible.

    #img3 {
      background-color: red; /* to make it visible */
    }
    
    .flexDisplay {
      display: flex;
    }
    
    .wrapper {
      display: flex;
      justify-content: space-evenly;
    }
    
    .loginImage {
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
    }
    
    @keyframes spin {
      from {
        transform: rotate(0deg);
      }
      to {
        transform: rotate(360deg);
      }
    }
    
    .img1 {
      animation: spin 3s linear infinite;
      opacity: 0.1;
      width: 200px;
      height: 200px;
      align-items: center;
    }
    
    .elementToFadeInAndOut {
      width: 200px;
      height: 200px;
      background: red;
      animation: fadeinout 4s linear infinite;
    }
    
    @keyframes fadeinout {
      0%,
      100% {
        opacity: 0;
      }
      50% {
        opacity: 1;
      }
    }
    branding logo branding logo img

提交回复
热议问题