行业知识
【前端系列】20种 Button 样式
2026-11-06 12:48:09
来源:互联网转载
在前端开发中,按钮(Button)是网页交互中常见的元素之一,其样式的设计直接影响着用户体验和界面美观度。本文将介绍20种不同的 Button 样式,旨在帮助前端开发者丰富按钮设计思路,提高用户界面的吸引力和可用性。
1. 默认样式
.button { background-color: #007bff; color: #fff; border: 1px solid #007bff;} 2. 扁平样式
.button { background-color: transparent; color: #007bff; border: none;} 3. 圆角样式
.button { border-radius: 5px;} 4. 阴影样式
.button { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);} 5. 渐变样式
.button { background: linear-gradient(to right, #ff4e50, #f9d423); color: #fff;} 6. 边框样式
.button { border: 1px solid #007bff; background-color: transparent; color: #007bff;} 7. 透明样式
.button { background-color: transparent; color: #007bff;} 8. 图标样式
.button { padding-left: 20px; background: url('icon.png') left center no-repeat;} 9. 悬浮样式
.button:hover { background-color: #0056b3;} 10. 点击样式
.button:active { transform: translateY(1px);} 11. 圆形样式
.button { border-radius: 50%;} 12. 边框渐变样式
.button { border: 1px solid transparent; background: linear-gradient(to right, #ff4e50, #f9d423); color: #fff;} 13. 悬浮渐变样式
.button:hover { background: linear-gradient(to right, #ff4e50, #f9d423); color: #fff;} 14. 三维样式
.button { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);} 15. 反向样式
.button { background-color: #007bff; color: #fff;}.button:hover { background-color: transparent; color: #007bff;} 16. 边框圆角样式
.button { border-radius: 20px; border: 1px solid #007bff;} 17. 悬浮阴影样式
.button:hover { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);} 18. 打字机样式
.button { overflow: hidden;}.button:after { content: ' '; display: inline-block; width: 0; animation: typing 3s steps(40, end);}@keyframes typing { from { width: 0; } to { width: 100%; }} 19. 灯泡样式
.button { background: url('lightbulb.png') center center no-repeat;} 20. 鼓起样式
.button { transform: scale(1.1);}
下一篇:不夜城在哪个服务器怎么进?