top of page
Writer's pictureWeb Coding

How to create flashing neon text for your website

Today I will be teaching you how to create flashing neon text for your website using CSS animation


HTML

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>Document</title>
 <link rel="stylesheet" href="style.css">
</head>
<body>
 <p>Hello</p>
</body>
</html>

CSS

*{
 padding0;
 margin0;
}

body{
 min-height100vh;
 displayflex;
 align-itemscenter;
 justify-contentcenter;
 backgroundblack;
}

p{
 text-transformuppercase;
 font-size104px;
 colorwhite;
 animation-name: neonFlicker;
 animation-duration1.5s;
 animation-timing-functionlinear;
 animation-iteration-count:infinite;
 animation-directionalternate;
}

@keyframes neonFlicker{
    0% {text-shadownone;}
    100% {text-shadow0 0 5px #fff0 0 10px #fff,
 0 0 20px #46008C0 0 25px #46008C,
 0 0 30px #46008C0 0 35px #46008C,
 0 0 40px #46008C;}
}

If you found this blog post helpful don’t forget to check out my other projects and if you want more content follow me on


YouTube: https://www.youtube.com/channel/UC2nxqB2usQIS2c8zwVZKWEQ

Instagram: https://www.instagram.com/coding_for_the_web/

Twitter: https://twitter.com/LearnWebCoding

11 views

Comments


bottom of page