Home > Web Front-end > CSS Tutorial > CSS to achieve glowing button effect (code example)

CSS to achieve glowing button effect (code example)

不言
Release: 2018-11-20 11:32:49
Original
9592 people have browsed it

We often use button effects. This article will share with you the implementation of a beautiful button effect. Let’s use CSS to achieve a glowing button effect.

Without further ado, let’s look directly at the code

The following code is the basic code for all subsequent button styles:

HTML

<a class="button" href="#">Button</a>
Copy after login

CSS

.button {
width:80px;
height:20px;
  display: block;  
  padding: 1em 3.2em;  
  border-radius: 1.6em;  
  color: #fff;  
  font-size: 18px;  
  font-family: &#39;Lato&#39;, sans-serif;  
  font-weight: 700;  
  text-align: center;  
  text-decoration: none;
  }
Copy after login

The basic color is changed from button1 to button4 below, and the color transmittance of the button body is also adjusted by box-shadow to describe the shadow used for each button. Start designing buttons with gradient effects starting from button5. Let's look at the specific code implementation.

button1:

.button {
  background-color: rgba(252, 28, 143, 1);  
  box-shadow: 0 5px 20px rgba(252, 28, 143, .5);
}
Copy after login

The effect is as follows:

CSS to achieve glowing button effect (code example)

button2:

.button{
background-color: rgba(251, 152, 11, 1);  
box-shadow: 0 5px 20px rgba(251, 152, 11, .5);
}
Copy after login

The effect is as follows:

CSS to achieve glowing button effect (code example)

button3:

.button {
  background-color: rgba(241, 196, 15, 1);  
  box-shadow: 0 5px 20px rgba(241, 196, 15, .5);
}
Copy after login

The effect is as follows:

CSS to achieve glowing button effect (code example)

button4:

.button {
  background-color: rgba(0, 63, 255, 1);  
  box-shadow: 0 5px 20px rgba(0, 63, 255, .5);
}
Copy after login

The effect As follows:

CSS to achieve glowing button effect (code example)

button5:

The basic appearance is "button4", box-shadow changes the position of the shadow attached below by setting the shadow .

.button {
  background-color: rgba(0, 63, 255, 1);  
  box-shadow: 0 0 40px rgba(0, 63, 255, .7);
}
Copy after login

The effect is as follows:

CSS to achieve glowing button effect (code example)

button6:

This is the box-shadow we added to the "button4" position specified by inset.

.button {
  background-color: rgba(0, 63, 255, 1);  
  box-shadow: 0 5px 20px rgba(0, 63, 255, .5), 0 0 40px rgba(255, 255, 255, .5) inset;
}
Copy after login

The effect is as follows:

CSS to achieve glowing button effect (code example)

button7:

Use the gradient type button to combine different colors and adjust the angle .

.button {
  background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);  
  box-shadow: 0 5px 20px rgba(0, 63, 255, .5);
}
Copy after login

The effect is as follows:

CSS to achieve glowing button effect (code example)

#The above is the entire content of this article. For more other exciting content, please refer to the video tutorial on the php Chinese website The CSS video tutorial and CSS3 video tutorial columns in the column! ! !

The above is the detailed content of CSS to achieve glowing button effect (code example). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template