当前位置:首页 » 《休闲阅读》 » 正文

【前端系列】20种 Button 样式

29 人参与  2024年09月08日 15:24  分类 : 《休闲阅读》  评论

点击全文阅读


在前端开发中,按钮(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);}

以上示例展示了每种 Button 样式对应的基本 CSS 样式。可以根据具体需求对这些样式进行调整和组合,以达到设计的效果。


点击全文阅读


本文链接:http://zhangshiyu.com/post/157061.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1