How to auto flip CSS cards till some duration and make them disappear from screen on a button click?

I am trying to build a lucky draw system. There are 8 cards in each category and 8 people to assign those cards. I want to make a flipping animation on cards that all cards flip till 10 seconds then only one card appear on screen as jackpot. How can I achieve that with CSS and JavaScript?

My current code:-

CSS

.card {
display: grid;
  grid-template-columns: 300px;
float: none; /* Added */
  margin-top: 50px;
  border-radius: 18px;
  align-content: center;
margin-left: auto;
margin-right: auto;
  background-color: #FFEB3B;

  box-shadow: 5px 5px 15px rgba(0,0,0,0.9);
  font-family:Lucida Handwriting;
  text-align: center;


  transition: 0.5s ease;
  cursor: pointer;
}

In current system i am loading all cards to screen. How can i make them rotate for 10 seconds and make only one card visible and other disappear on a button click.

13 thoughts on “How to auto flip CSS cards till some duration and make them disappear from screen on a button click?”

Leave a Comment