Blinking Text with CSS3 and jQuery

jQuery

Blinking text effect was mostly used effect using <blink> element of HTML but all know that the <blink> element is now deprecated, but still we can make blinking text effect with either CSS3 or jQuery.

Blinking text effect is basically works on opacity means first set opacity to 1 and than put it to 0 with some delay. Let’s play with code.

Using CSS3


.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; }
}

<span class="blink_me">Wow, its a blinking link!</span>

Here, i have used vendor prefixes but still older browser won’t support this effect so alternatively we should use jquery fadeIn() and fadeOut() method to blink text. Learn more about CSS at https://css-diary.com/measurement-units-in-css/

Using jQuery

We are going to mess with jquery so first of all we need to import jquery library in order to make working it’s all functions.


function blinker() {
    $('.blink_me').fadeOut(500);
    $('.blink_me').fadeIn(500);
}
setInterval(blinker, 1000); //Runs every second

<span class="blink_me">Wow, its a blinking link!</span>

Leave a Reply

Your email address will not be published. Required fields are marked *

CSS measuring Units
CSS Web Design

Measurement Units in CSS

CSS offers a number of different units for expressing length. It includes absolute units such as inches, centimeters, points, and so on, as well as relative measures such as percentages and em units. You required these values while specifying various measurements in your stylesheet. It supports various measurement units which are listed below: Using em This measurement […]

Read More
WordPress Loop
CSS

WordPress Loop

The WordPress loop is a list of all or limited number of post and page entries in database. It is the main part of each WordPress theme and core of every WordPress powered site. It cycles through posts that allow us to display them in any manner we want. Before we start, let’s see how […]

Read More
Fonts
CSS

11 Great and Modern Fonts with Personality

This font collection is created by Antonio Rodrigues who is Brazil-born graphic designer and illustration. His work includes projects in typography, lettering, crafts, branding and sculpture. 1. Berlin Berlin is a group of display fonts inspired by the classic geometric typefaces from early last century. It features (so far) four versions, each one in three weights: regular, […]

Read More