Need divs to be push down using only CSS

后端 未结 1 1355
孤独总比滥情好
孤独总比滥情好 2021-01-29 07:05

I have this code that is using jQuery, but I want to know is is possible to achieve the same result using only CSS. This is my code on Codepen: https://codepen.io/dj-smoke

相关标签:
1条回答
  • 2021-01-29 07:34

    I made again :)

    body {
      background-color: #ffffd;
      padding: 1em;
    }
    .cardWrap {
      display:flex;
      flex-direction:column-reverse;
    }
    .card { 
      background:#fff; 
      animation: slide 0.5s linear both;
      margin-bottom: 0;
      opacity: 0;
      padding:0;
      height:0px;
      width:0px;
      
    }
    
    .card:nth-child(1) {
      animation: card1 .3s forwards .5s;
    }
    
    .card:nth-child(2) {
      animation: card1 .3s forwards 1.5s;
    }
    
    .card:nth-child(3) {
      animation: card1 .3s forwards 2.5s;
    }
    
    .card:nth-child(4) {
      animation: card1 .3s forwards 3.5s;
    }
    
    .card:nth-child(5) {
      animation: card1 .3s forwards 4.5s;
    }
    
    .card:nth-child(6) {
      animation: card1 .3s forwards 5.5s;
    }
    
    .card:nth-child(7) {
      animation: card1 .3s forwards 6.5s;
    }
    
    .card:nth-child(8) {
      animation: card1 .3s forwards 7.5s;
    }
    
    .card:nth-child(9) {
      animation: card1 .3s forwards 8.5s;
    }
    
    .card:nth-child(10) {
      animation: card1 .3s forwards 9.5s;
    }
    
    .card:nth-child(11) {
      animation: card1 .3s forwards 10.5s;
    }
    
    
    @keyframes card1{
      to{opacity:1;height:auto;width:auto;padding:5px;margin-bottom: 1em;}
    }
    <div class="cardWrap">
      <div class="card">pushed DOWN</div>
      <div class="card">10 - Itin</div>
      <div class="card">9 - Itin</div>
      <div class="card">8 - Itin</div>
      <div class="card">7 - Itin</div>
      <div class="card">6 - Itin</div>
       <div class="card">5 - Itin</div>
      <div class="card">4 - Itin</div>
      <div class="card">3 - Itin</div>
      <div class="card">2 - Itin</div>
      <div class="card">1 - Itin</div>
    </div>

    0 讨论(0)
提交回复
热议问题