Alternative for <blink>

后端 未结 14 2191
广开言路
广开言路 2020-11-27 06:39

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

Is there a standards compliant way of making text blink?

相关标签:
14条回答
  • 2020-11-27 07:09

    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>

    0 讨论(0)
  • 2020-11-27 07:14

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

    0 讨论(0)
提交回复
热议问题