Hello, in this tutorial, I will show you how to create a NEON button in minutes.
Hello, in this tutorial, I will show you how to create a NEON button in minutes.
There is an outer and inner glow around the borders to imitate light coming out from a fluorescent bulb.
Setting up the HTML Page
Begin by adding a button on the page and apply the neon-btn class to it.
Building the CSS
Then create a CSS file and add it to the HTML page.
<link rel="stylesheet" href="./index.css">
In the CSS file, create a variable for the glow color, glow spread color, enhanced glow color, and the button color.
Now that we have our variables, let’s center the button so we can see it better.
Decorating the Button
For the next part, we can begin decorating the button.
Adding the Glow Effects
Now that we have a firm structure for a button, we can start adding the effects for the outer and inner glow. To do this, we need to use the box-shadow property.
To add the first layer, put 0, 0 for the first 2 values. This represents the x and y position of where the box shadow will start.
For the larger layer outside, we'll do the same, except, we need to increase the blur and spread radius so it’ll be larger than the first one.
The last thing to finish up the button is to add a glow for the text of the button.
Creating the Glow on the Floor
Now that the button is complete, the next step is to create the glow underneath the button.
.neon-btn::after {
Set:
If we take a look at the button now, there will be box underneath the button.
We’ll use this box to create the effect that light is hitting the ground.
If we compare this to the preview, the effects are not as noticeable. When light hit the floor at this angle, the glow should spread in an arc, so it looks like there is a floor and not just a wall.
Add the transform property.
transform: perspective(1.5em) rotateX(35deg);
If we take out the blur and opacity effect, you can see how the box is rotated in the X axis and that it seems like the box is arcing out.
For the 3rd transform, use scale to flatten the effect.
transform: perspective(1.5em) rotateX(35deg) scale(1, .6);
If we re-apply the blur and opacity, it will look like how we want it to be.
Adding Hover Effects
That is all for this tutorial. If you find this helpful, please like, share, and subscribe to support the channel.
Download the project here
https://codeible.com/coursefiles/buildinganeonbutton