Search code examples
htmlcssfade

How can I constantly fade an HTML button in and out with CSS?


I'm designing an HTML game and I would like to know how I can constantly fade in and out the "START" button in the game with CSS.

  • If jQuery is needed, that's okay; however, whenever possible, please use pure HTML and CSS. Thanks!

Solution

  • .pulseButton {
      animation: pulse 5s infinite;
    }
    
    @keyframes pulse {
      0% {
        opacity: 1;
      }
      50% {
        opacity: 0;
      }
      100% {
        opacity: 1;
      }
    }`