74

The <blink> tag was never an official standard, and is now completely abandoned by all browsers.

Is there a standards compliant way of making text blink?

jobukkit
  • 2,490
  • 8
  • 26
  • 41
  • 9
    Javascript all ze things ! – HamZa Aug 07 '13 at 13:48
  • 2
    Don't use that, please. If you really, really... REALLY MUST use that, feel free to implement it in new CSS or Javascript/jQuery. There is even [blink plugin made for that](http://plugins.jquery.com/modern-blink/). – OzrenTkalcecKrznaric Aug 07 '13 at 13:49
  • 6
    I once read that blink was added to netscape as a joke. – DwB Aug 07 '13 at 13:50
  • Try This...http://stackoverflow.com/a/20270551/3944217 – Edwin Thomas Oct 01 '14 at 11:39
  • Google surely thinks it's a joke: https://www.google.be/search?q=blink+html (easter egg :-) ) – K.C. Sep 11 '15 at 12:36
  • 2
    As gaudy as it is it could still be useful for things like visually declaring that the user is using the staging/test version of a site instead of the production version etc. – emurano Oct 11 '15 at 05:00
  • Possible duplicate of [Blinking text cross browser](http://stackoverflow.com/questions/4894488/blinking-text-cross-browser) – Luciano May 25 '16 at 12:15
  • 1
    Yes, `` was originally conceived as a joke. See here: [montulli.org](http://www.montulli.org/theoriginofthe%3Cblink%3Etag). – David R Tribble Feb 19 '19 at 23:30
  • @emurano I would rather use a non-blinking banner instead, like [what Flutter does by default](https://api.flutter.dev/flutter/widgets/CheckedModeBanner-class.html). – Lambda Fairy May 30 '20 at 06:13

14 Answers14

92

.blink_text
{
    animation:1s blinker linear infinite;
    -webkit-animation:1s blinker linear infinite;
    -moz-animation:1s blinker linear infinite;
    color: red;
}

@-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_text">India's Largest portal</span>
Pikamander2
  • 7,332
  • 3
  • 48
  • 69
Elangovan
  • 3,469
  • 4
  • 31
  • 38
29

No there is not. Wikipedia has a nice article about this and provides an alternative using JavaScript and CSS: http://en.wikipedia.org/wiki/Blink_element

Christophe Herreman
  • 15,895
  • 9
  • 58
  • 86
  • 8
    Thanks the Javascript thing works! "No there is not" This is standards compliant isn't it? I mean, it's Javascript... – jobukkit Aug 09 '13 at 09:28
13

No, there isn't in HTML. There is a good reason why the developers chose to go out of their way to remove support for an element whose implementation was otherwise untouched for upwards of a decade.

That said... you could emulate it using a CSS animation, but if I were you, I wouldn't risk CSS animations being axed due to being abused in this manner :)

Community
  • 1
  • 1
BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
  • See this for an example of css 3 animation used to blink text - http://googlesystem.blogspot.co.uk/2014/02/googles-blink-easter-egg.html – John Feb 25 '14 at 08:40
  • 6
    What would that "good reason" be? I was planning to use it while reading version information for the rpm packages that are installed on the server, i.e. "Retrieving data - stand by". Is there something wrong with using blinking text in that way? – CramerTV Sep 24 '14 at 23:03
4

Please try this one and I guarantee that it will work

  <script type="text/javascript">
  function blink() {
  var blinks = document.getElementsByTagName('blink');
  for (var i = blinks.length - 1; i >= 0; i--) {
  var s = blinks[i];
  s.style.visibility = (s.style.visibility === 'visible') ? 'hidden' : 'visible';
}
window.setTimeout(blink, 1000);
}
if (document.addEventListener) document.addEventListener("DOMContentLoaded", blink, false);
else if (window.addEventListener) window.addEventListener("load", blink, false);
else if (window.attachEvent) window.attachEvent("onload", blink);
else window.onload = blink;

Then put this below:

<blink><center> Your text here </blink></div>
Reu Roo
  • 131
  • 1
  • 10
  • Yes this works, but can be improved. 1) You don't need to query `blinks` tags each time using the `getElementsByTagName` . In fact you can just query it once because it will auto update by itself (in short: declare that variable once and outside the loop), 2) function > timeout > function > timeout > .. it's going very deep, a simple `setInterval` should be good. (ps. good point using a reverse for-loop) take my upvote for this evil code ;) – Sabaz Jun 21 '16 at 08:19
3

The blink element is being abandoned by browsers: Firefox supported it up to version 22, and Opera up to version 12.

The HTML5 CR, which is the first draft specification that mentions blink, declares it as “obsolete” but describes (in the Rendering section) its “expected rendering” with the rule

blink { text-decoration: blink; }

and recommends that the element be replaced by the use of CSS. There are actually several alternative ways of emulating blink in CSS and JavaScript, but the rule mentioned is the most straightforward one: the value blink for text-decoration was defined specifically to provide a CSS counterpart to the blink element. However, support to it seems to be as limited as for the blink element.

If you really want to make content blink in a cross-browser way, you can use e.g. simple JavaScript code that changes content to invisible, back to visible etc. in a timed manner. For better results you could use CSS animations, with somewhat more limited browser support.

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390
  • 4
    Pssht... the example is an animated GIF ;) – Thomas Aug 07 '13 at 18:18
  • 3
    `` and `text-decoration: blink` were removed (technically, the latter recognized but ignored) in Firefox 23, which was released yesterday. So even though HTML5 says to apply that declaration to the `` element, chances are it won't actually take effect in the newest browsers. – BoltClock Aug 07 '13 at 18:33
  • Thanks for the comments. I have edited the answer. The animated GIF really tricked me. – Jukka K. Korpela Aug 07 '13 at 20:57
  • "The blink element has been completely abandoned by browsers: Firefox supported it up to version 22, and current version (12.51) of Opera still does." The current version of Opera is Opera 15 and Opera 15 also doesn't support it anymore. The news of Firefox not supporting it anymore since version 23 is how I learned about the existance of the `blink` tag. The example is an animated GIF indeed ;) – jobukkit Aug 08 '13 at 16:32
  • Oops, I meant to write that the element has *not* (yet) been completely abandoned by browsers. Re Opera, I was misled by the browser’s own update feature: it updated to the latest (last?) version in the 12 “series”, but the newest version is indeed 15. So I’ll modify the answer again. – Jukka K. Korpela Aug 08 '13 at 19:09
2

You could take advantage of JavaScript's setInterval function:

const spanEl = document.querySelector('#spanEl');
var interval = setInterval(function() {
  spanEl.style.visibility = spanEl.style.visibility === "hidden" ? 'visible' : 'hidden';
}, 250);
<span id="spanEl">This text will blink!</span>
Tom O.
  • 5,730
  • 2
  • 21
  • 35
2

Blinking text with HTML and CSS only

<span class="blinking">I am blinking!!!</span>

And Now CSS code

    .blinking{
        animation:blinkingText 0.8s infinite;
    }

    @keyframes blinkingText{
        0%{     color: #000;    }
        49%{    color: transparent; }
        50%{    color: transparent; }
        99%{    color:transparent;  }
        100%{   color: #000;    }
    }
Faridul Khan
  • 1,741
  • 1
  • 16
  • 27
2

The blick tag is deprecated, and the effect is kind of old :) Current browsers don't support it anymore. Anyway, if you need the blinking effect, you should use javascript or CSS solutions.

CSS Solution

blink {
    animation: blinker 0.6s linear infinite;
    color: #1c87c9;
}
@keyframes blinker {  
    50% { opacity: 0; }
}
.blink-one {
    animation: blinker-one 1s linear infinite;
}
@keyframes blinker-one {  
    0% { opacity: 0; }
}
.blink-two {
    animation: blinker-two 1.4s linear infinite;
}
@keyframes blinker-two {  
    100% { opacity: 0; }
}
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <h3>
      <blink>Blinking text</blink>
    </h3>
    <span class="blink-one">CSS blinking effect for opacity starting with 0%</span>
    <p class="blink-two">CSS blinking effect for opacity starting with 100%</p>
  </body>
</html>

sourse: HTML blink Tag

Vazgen Manukyan
  • 1,410
  • 1
  • 12
  • 17
1

If you're looking to re-enable the blink tag for your own browsing, you can install this simple Chrome extension I wrote: https://github.com/etlovett/Blink-Tag-Enabler-Chrome-Extension. It just hides and shows all <blink> tags on every page using setInterval.

etlovett
  • 629
  • 1
  • 7
  • 15
1

HTML Code

<span class="blinking">Am I blinking?</span>

CSS code

.blinking{
    animation:blinkingText 1.2s infinite;
}
@keyframes blinkingText{
    0%{     color: #000;    }
    49%{    color: #000; }
    60%{    color: transparent; }
    99%{    color:transparent;  }
    100%{   color: #000;    }
}
<span class="blinking">Am I blinking?</span>

Ref:https://html-online.com/articles/blinking-text-css-animation/

Kuhan
  • 495
  • 7
  • 17
0

A small javascript snippet to mimic the blink , no need of css even

<span id="lastDateBlinker">
    Last Date for Participation : 30th July 2014
</span>

<script type="text/javascript">
    function blinkLastDateSpan() {
        if ($("#lastDateBlinker").css("visibility").toUpperCase() == "HIDDEN") {
            $("#lastDateBlinker").css("visibility", "visible");
            setTimeout(blinkLastDateSpan, 200);
        } else {
            $("#lastDateBlinker").css("visibility", "hidden");
            setTimeout(blinkLastDateSpan, 200);
        }
    }
    blinkLastDateSpan();
</script>
Morteza Tourani
  • 3,506
  • 5
  • 41
  • 48
Raaghu
  • 1,956
  • 1
  • 19
  • 17
0

The solution below is interesting because it can be applied across multiple elements concomitantly and does not trigger an error when the element no longer exists on the page. The secret is that it is called passing as a parameter a function in which you must return the elements you want to be affected by the blink. Then this function is called back with each blink. HTML file below:

<!doctype>
<html>
    <head>
        <style>
            .blink {color: red}
        </style>
    </head>
    <body>
        <h1>Blink test</h1>
        <p>
            Brazil elected President <span class="blink">Bolsonaro</span> because he 
            was the only candidate who did not promise <span class="blink">free things</span>
            to the population. Previous politicians created an image that would 
            bring many benefits, but in the end, the state has been getting more and 
            more <span class="blink">burdened</span>. Brazil voted for the 
            realistic idea that <span class="blink">there is no free lunch</span>.
        </p>
    </body>
    <script>
    var blink =
        {
            interval_in_miliseconds:
                400,
            on:
                true,
            function_wich_returns_the_elements: 
                [],
            activate:
                function(function_wich_returns_the_elements)
                {
                    this.function_wich_returns_the_elements = function_wich_returns_the_elements;
                    setInterval(blink.change, blink.interval_in_miliseconds);
                },
            change:
                function()
                {   
                    blink.on = !blink.on;
                    var i, elements = [];
                    for (i in blink.function_wich_returns_the_elements)
                    {
                        elements = elements.concat(blink.function_wich_returns_the_elements[i]());
                    }
                    for (i in elements)
                    {
                        if (elements[i])
                        {
                            elements[i].style.opacity = blink.on ? 1 : .2;
                        }
                    }
                }
        };
    blink.activate
    (
        [
            function()
            {
                var 
                    i,
                    node_collection = document.getElementsByClassName('blink'),
                    elements = [];
                for (i = 0; i < node_collection.length; i++)
                {
                    elements.push(node_collection[i]);
                }
                return elements;
            }
        ]
    );
    </script>
</html>
Daniel
  • 1
0

can use this

@keyframes blinkingText
{
    0%{     opacity: 1;    }
    40%{    opacity: 0; }
    60%{    opacity: 0; }
    100%{   opacity: 1;    }
}

.blinking
{
    animation:blinkingText 2s reverse infinite;
}
Ali Bagheri
  • 3,068
  • 27
  • 28
-1

Here's some code that'll substitute for the blink tag

<p id="blink">This text will blink!</p>
<script>
var blacktime = 1000;
var whitetime = 1000;
//These can be as long as you desire in milliseconds
setTimeout(whiteFunc,blacktime);
function whiteFunc(){
    document.getElementById("blink").style.color = "white";
    setTimeout(blackFunc,whitetime);
}
function blackFunc(){
    document.getElementById("blink").style.color = "black";
    setTimeout(whiteFunc,blacktime);
}
</script>