css发光按钮制作
制作CSS发光按钮的方法
使用CSS的box-shadow属性可以轻松实现发光效果。以下是一个基础示例:
.glow-button {
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
transition: box-shadow 0.3s ease;
}
.glow-button:hover {
box-shadow: 0 0 15px #4CAF50;
}
多色发光效果
通过叠加多层阴影可以实现更丰富的发光效果:
.multi-glow {
padding: 12px 24px;
background: linear-gradient(45deg, #ff00cc, #3333ff);
color: white;
border: none;
border-radius: 8px;
font-weight: bold;
transition: all 0.3s ease;
}
.multi-glow:hover {
box-shadow:
0 0 10px #ff00cc,
0 0 20px #3333ff,
0 0 30px rgba(255, 0, 204, 0.5);
transform: scale(1.05);
}
脉冲发光动画
使用CSS动画创建脉冲发光效果:
.pulse-button {
padding: 15px 30px;
background-color: #ff5722;
color: white;
border: none;
border-radius: 50px;
font-size: 18px;
position: relative;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(255, 87, 34, 0.7);
}
70% {
box-shadow: 0 0 0 15px rgba(255, 87, 34, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(255, 87, 34, 0);
}
}
边框发光效果
创建仅边框发光的按钮:
.border-glow {
padding: 12px 25px;
background-color: transparent;
color: #00ffff;
border: 2px solid #00ffff;
border-radius: 4px;
font-size: 16px;
transition: all 0.3s ease;
}
.border-glow:hover {
box-shadow: 0 0 10px #00ffff, inset 0 0 10px #00ffff;
text-shadow: 0 0 5px #00ffff;
}
霓虹灯效果
模拟霓虹灯发光按钮:

.neon-button {
padding: 15px 30px;
background-color: #1a1a1a;
color: #fff;
border: 4px solid #ff0bac;
border-radius: 10px;
font-family: 'Arial', sans-serif;
font-size: 20px;
text-transform: uppercase;
letter-spacing: 2px;
position: relative;
overflow: hidden;
}
.neon-button::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 11, 172, 0.4), transparent);
transition: 0.5s;
}
.neon-button:hover::before {
left: 100%;
}
.neon-button:hover {
box-shadow: 0 0 10px #ff0bac, 0 0 40px #ff0bac, 0 0 80px #ff0bac;
}
这些示例展示了不同风格的CSS发光按钮实现方式,可以根据需要调整颜色、大小和动画参数来创建自定义效果。






