Blink Element In Coding: Here's Why It's A Bad Idea
Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Proprietary Element
The <blink>
element was introduced by Microsoft as a proprietary feature of Internet Explorer. It was never a part of the HTML specification. Today, it is not supported at all, even by IE.
With CSS: text-decoration: blink
An alternative way to accomplish this (ill-advised) effect was to use set text-decoration: blink;
in CSS. Fortunately, this is not part of the CSS specification either, and does not work on most browsers.
If you really, really have to
If you need to cause text to blink in and out, you are probably doing something awful. It is an extremely annoying effect. That being said, you can accomplish it with JavaScript.
<span id="blinker">Blink! Blink! Blink!</span>
var blink_speed = 500;
var t = setInterval(function () {
var ele = document.getElementById('blinker');
ele.style.visibility = (ele.style.visibility == 'hidden' ? '' : 'hidden');
}, blink_speed);
Blink! Blink! Blink!
var blink_speed = 500; var t = setInterval(function () { var ele = document.getElementById(‘blinker’); ele.style.visibility = (ele.style.visibility == ‘hidden’ ? ” : ‘hidden’); }, blink_speed);
var blink_speed = 500; var t = setInterval(function () { var ele = document.getElementById(‘blinker’); ele.style.visibility = (ele.style.visibility == ‘hidden’ ? ” : ‘hidden’); }, blink_speed);
JS Code by Chris Baker, via Stack Overflow. Licensed in the Public Domain.