htmlcsscss-animationsblink

Imitating a blink tag with CSS3 animations


I really want to make a piece of text blink the old-school style without using javascript or text-decoration.

No transitions, only *blink*, *blink*, *blink*!


This is different from that question because I ask for blinking without continuous transitions, whereas OP of the other questions asks how to replace blinking with continuous transitions


Solution

  • The original Netscape <blink> had an 80% duty cycle. This comes pretty close, although the real <blink> only affects text:

    .blink {
      animation: blink-animation 1s steps(5, start) infinite;
      -webkit-animation: blink-animation 1s steps(5, start) infinite;
    }
    @keyframes blink-animation {
      to {
        visibility: hidden;
      }
    }
    @-webkit-keyframes blink-animation {
      to {
        visibility: hidden;
      }
    }
    This is <span class="blink">blinking</span> text.

    You can find more info about Keyframe Animations here.