How to make blinking/flashing text with CSS 3
For a rapid CSS3 blinking effect, use the @keyframes
rule along with the opacity attribute
. Here's a crisp example:
Add the .blink-text
class to your HTML text:
This renders your text in a blink mode, creating an on-off effect every second.
Make it smooth and even
Ensure your blink animation doesn't feel erratic—a smooth, consistent rhythm works best. Setting your animation-timing-function
to linear
ensures a steady blink while the infinite
keyword keeps the excitement going without needing extra JavaScript:
This creates a uniform transition and a polished blink effect.
Compatibility across browsers
Your animation should put on a show for everyone! Adding vendor prefixes ensures more users across different browsers see your sparkling text. Additionally, incorporate a jQuery fallback system with .fadeOut().fadeIn()
, as an extra safety net for those legacy IE users:
Enhanced user experience
Ensure that blinking text serves a clear goal and doesn't distract. Here are some techniques:
Draw attention subtly
Use a subtler blink for notification icons or informational messages to be polite yet effective:
Consider accessibility
Remember-blindly repeating blinking text can be problematic for individuals with photosensitive epilepsy. Add an option to stop or reduce blinking:
Use color for visual cues
By tying color transitions with opacity, you can create an eye-catching effect that signals a status change:
Was this article helpful?