How to make text blink on website?
Categories:
How to Make Text Blink on Your Website

Explore various methods to create blinking text effects on your website using HTML and CSS, understanding their implications and best practices.
Blinking text, while once a common feature on early web pages, is now generally considered an outdated and potentially distracting design element. However, there might be specific use cases where a subtle blinking effect could be desired, such as drawing attention to a temporary notice or a live status indicator. This article will guide you through different techniques to achieve blinking text using HTML and CSS, while also discussing accessibility considerations and modern alternatives.
The Deprecated <blink>
Tag
Historically, HTML offered a dedicated <blink>
tag for creating blinking text. This tag was non-standard and has been deprecated for a long time due to its negative impact on accessibility and user experience. Modern browsers no longer support it, and its use is strongly discouraged. Attempting to use it will simply render the text without any blinking effect.
<!-- This tag is deprecated and will not blink in modern browsers -->
<blink>This text will not blink</blink>
Example of the deprecated <blink>
tag.
<blink>
tag. It is deprecated, not supported by modern browsers, and creates accessibility issues for users, especially those with cognitive disabilities or photosensitivity.Achieving Blinking Text with CSS Animations
The recommended and most flexible way to create a blinking effect is by using CSS animations. This method provides granular control over the animation's timing, duration, and appearance, making it much more adaptable and accessible than the old <blink>
tag. We'll define a @keyframes
rule to toggle the text's visibility or opacity.
<p class="blink-text">Important Announcement!</p>
HTML structure for text to be animated.
.blink-text {
animation: blinker 1s linear infinite;
}
@keyframes blinker {
50% { opacity: 0; }
}
CSS animation to make text blink by changing opacity.
In this CSS example, the blinker
keyframe animation changes the opacity
of the element to 0
(fully transparent) at the 50% mark of its duration. The animation
property then applies this keyframe to the .blink-text
class:
blinker
: The name of the@keyframes
rule.1s
: The duration of one animation cycle (1 second).linear
: The animation timing function, ensuring a consistent speed.infinite
: The animation will repeat indefinitely.
flowchart TD A[Start Animation] --> B{0% Opacity: 1} B --> C{50% Opacity: 0} C --> D{100% Opacity: 1} D --> A
CSS Blinking Animation Flow (Opacity Toggle)
Accessibility Considerations and Alternatives
While CSS animations offer control, blinking or flashing content can be problematic for users with certain conditions, such as photosensitive epilepsy, ADHD, or cognitive disabilities. The Web Content Accessibility Guidelines (WCAG) recommend that content should not flash more than three times in any one-second period. For this reason, it's often better to use more subtle ways to draw attention.
Practical Steps for Implementing Blinking Text (Responsibly)
If you must use blinking text, follow these steps to implement it using CSS animations, keeping accessibility in mind.
1. Add HTML Element
Place the text you want to blink inside an HTML element, such as a <span>
or <p>
, and assign it a unique class or ID.
2. Define Keyframes
In your CSS, define a @keyframes
rule that changes the opacity
or visibility
of the element. For example, 50% { opacity: 0; }
.
3. Apply Animation
Apply the animation to your HTML element using the animation
property, specifying the keyframe name, duration, timing function, and iteration count (e.g., infinite
).
4. Test and Refine
Test the effect across different browsers and devices. Crucially, ensure the blinking rate is slow enough (e.g., 1 second or more per cycle) to avoid triggering photosensitive reactions and to remain readable.