CSS3是一种用于网页设计的样式表语言,可以用于设计各种美观的按钮。其中,“光韵”是一种常见的CSS3按钮效果,它可以使按钮在被鼠标悬停或点击时呈现出不同的光影效果。/ 光韵按钮效果 / .butto...
CSS3是一种用于网页设计的样式表语言,可以用于设计各种美观的按钮。其中,“光韵”是一种常见的CSS3按钮效果,它可以使按钮在被鼠标悬停或点击时呈现出不同的光影效果。
/* 光韵按钮效果 */
.button {
display: inline-block;
position: relative;
padding: 12px 28px;
color: #ffffff;
font-size: 18px;
text-decoration: none;
border-radius: 8px;
box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.2);
background: linear-gradient(to bottom, #ff8a00, #ff5900);
transition: all 0.2s ease;
}
/* 悬停时的光韵效果 */
.button:hover {
box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}
/* 点击时的光韵效果 */
.button:active {
box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3);
} 以上代码使用了CSS3中的两个关键字:linear-gradient和box-shadow。其中,linear-gradient可以生成渐变色背景;box-shadow可以生成按钮的光影效果。
使用这些CSS3代码可以制作出炫酷的按钮效果,从而让网页设计更加生动有趣。如果您正在设计自己的网站,为什么不尝试一下CSS3按钮光韵效果呢?