The glowing star effect is one of the coolest effects that is used for dark themed websites. It is known as star effect because it has small glowing balls animated in different ways which looks like stars. This effect can be used for image slider, loader, and maybe as an showcase UI element.
Approach: The approach is to create small balls using unordered list and then animating them using keyframes and n-th child property. Basic knowledge of these two properties is a prerequisite of going any further in this article.
HTML Code: In this section, we have created an unordered list.
<!DOCTYPE html> <html> <head> <title>GLOWING STAR EFFECT</title> </head> <body> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </body> </html> |
CSS Code: For CSS, follow the given below steps:
- Step 1: Align the list according to your need. We have aligned the list to the center of the page.
- Step 2: Remove all the list styles and give them circle shape using border-radius.
- Step 3: Use keyframes to animate the balls by increasing the scale. There is no fix way of doing this you can change scale on different frames as you like.
- Step 4: Use n-th child property to apply some delay between animation of each li element.
Tip: This effect is one of the most versatile effects. You can change the type of animation on different frames or can change the delay. So, try out different values of the properties that are used in this article to find the best animation for yourself. Also this effect only looks good on a dark-theme page so don’t use it on light-themed websites.
body { background: rgb(70, 69, 69); } ul { position: absolute; top: 50%; left: 50%; display: flex; } ul li { list-style: none; width: 40px; height: 40px; background: #fff; border-radius: 50%; animation: animate 1.7s ease-in-out infinite; } @keyframes animate { 0%, 40%, 100% { transform: scale(0.2); } 20% { transform: scale(1); } } ul li:nth-child(1) { animation-delay: -1.2s; background: yellow; box-shadow: 0 0 50px yellow; } ul li:nth-child(2) { animation-delay: -1s; background: rgb(99, 247, 136); box-shadow: 0 0 50px rgb(99, 247, 136); } ul li:nth-child(3) { animation-delay: -0.8s; background: rgb(30, 243, 225); box-shadow: 0 0 50px rgb(30, 243, 225); } ul li:nth-child(4) { animation-delay: -0.6s; background: rgb(241, 58, 58); box-shadow: 0 0 50px rgb(241, 58, 58); } ul li:nth-child(5) { animation-delay: -0.4s; background: rgb(247, 61, 176); box-shadow: 0 0 50px rgb(247, 61, 176); } |
Complete Code: It is the combination of the above two sections of code.
<!DOCTYPE html> <html> <head> <title>GLOWING STAR EFFECT</title> <style> body { background: rgb(70, 69, 69); } ul { position: absolute; top: 50%; left: 50%; display: flex; } ul li { list-style: none; width: 40px; height: 40px; background: #fff; border-radius: 50%; animation: animate 1.7s ease-in-out infinite; } @keyframes animate { 0%, 40%, 100% { transform: scale(0.2); } 20% { transform: scale(1); } } ul li:nth-child(1) { animation-delay: -1.2s; background: yellow; box-shadow: 0 0 50px yellow; } ul li:nth-child(2) { animation-delay: -1s; background: rgb(99, 247, 136); box-shadow: 0 0 50px rgb(99, 247, 136); } ul li:nth-child(3) { animation-delay: -0.8s; background: rgb(30, 243, 225); box-shadow: 0 0 50px rgb(30, 243, 225); } ul li:nth-child(4) { animation-delay: -0.6s; background: rgb(241, 58, 58); box-shadow: 0 0 50px rgb(241, 58, 58); } ul li:nth-child(5) { animation-delay: -0.4s; background: rgb(247, 61, 176); box-shadow: 0 0 50px rgb(247, 61, 176); } </style> </head> <body> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </body> </html> |
Output:

Recommended Posts:
- How to Design Stitched Glowing Effect for Button using HTML and CSS ?
- Create a Glowing text shadow using HTML and CSS
- Create a 3D Text Effect using HTML and CSS
- How to create reflection effect using HTML and CSS ?
- How to Create Floating Box Effect using HTML and CSS ?
- How to Create Engraved Text Effect using HTML and CSS ?
- Create a Gradient Text Effect using HTML and CSS
- How to create followspot effect using HTML CSS and jQuery ?
- How to create multilayered text effect using HTML and CSS?
- How to create text-reveal effect using HTML and CSS ?
- How to create Skewed Background with hover effect using HTML and CSS?
- How to Create Liquid Filing Effect on Text using HTML and CSS ?
- How to Create Text Reveal Effect for Buttons using HTML and CSS ?
- How to Create Animated Navigation Bar with Hover Effect using HTML and CSS ?
- How to create shock wave or explosion effect using HTML and CSS ?
- How to Create an Effect to Change Button Color using HTML and CSS ?
- How to create paper corner fold effect on hover by using HTML and CSS?
- How to Create Loading Blur Text Animation Effect using HTML and CSS ?
- Glowing Cube loader using HTML & CSS
- How to Create Paradoxical Effect using CSS ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


