in snippets

How to make blinking/flashing text with CSS3 and jQuery

Blinking text was one of the most dreaded homepage effects in the 90’s. It was easily achieved by using the tag <blink> and was viewed upon as a real newbie thing to do. The tag <blink> is now a deprecated HTML element, but in the name of moving presentation/style to CSS3 and jQuery, there is now a way to achieve it.

Using CSS3

CSS

.blink_me {
    -webkit-animation-name: blinker;
    -webkit-animation-duration: 1s;
    -webkit-animation-timing-function: linear;
    -webkit-animation-iteration-count: infinite;

    -moz-animation-name: blinker;
    -moz-animation-duration: 1s;
    -moz-animation-timing-function: linear;
    -moz-animation-iteration-count: infinite;

    animation-name: blinker;
    animation-duration: 1s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@-moz-keyframes blinker {  
    0% { opacity: 1.0; }
    50% { opacity: 0.0; }
    100% { opacity: 1.0; }
}

@-webkit-keyframes blinker {  
    0% { opacity: 1.0; }
    50% { opacity: 0.0; }
    100% { opacity: 1.0; }
}

@keyframes blinker {  
    0% { opacity: 1.0; }
    50% { opacity: 0.0; }
    100% { opacity: 1.0; }
}

HTML

This Will Blink

Demo

This won’t work on older versions of Internet Explorer, for that, you need to use jQuery.

Using jQuery

Javascript:

function blinker() {
    $('.blink_me').fadeOut(500);
    $('.blink_me').fadeIn(500);
}

setInterval(blinker, 1000); //Runs every second

HTML:

This Will Blink

Demo