BootStrap笔记-按钮相关

x33g5p2x  于2022-02-07 转载在 Bootstrap  
字(5.3k)|赞(0)|评价(0)|浏览(433)

程序运行截图如下:

源码如下:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>CN_TEST1</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!-- bootstrap css核心文件-->
  8. <link rel="stylesheet" href="bootstrap-4.4.1-dist/css/bootstrap.min.css">
  9. <!-- bootstrap使用到了jquery,需要提前引用-->
  10. <script src="js/jquery-3.5.1.min.js"></script>
  11. <!-- 弹窗、提示、下拉菜单-->
  12. <script src="bootstrap-4.4.1-dist/js/bootstrap.bundle.js"></script>
  13. <!-- bootstrap核心文件-->
  14. <script src="bootstrap-4.4.1-dist/js/bootstrap.min.js"></script>
  15. </head>
  16. <body>
  17. <div class="container-fluid">
  18. <button type="button" class="btn">btn按钮</button>
  19. <button type="button" class="btn btn-primary">btn-primary按钮</button>
  20. <button type="button" class="btn btn-secondary">btn-secondary按钮</button>
  21. <button type="button" class="btn btn-success">btn-success按钮</button>
  22. <button type="button" class="btn btn-info">btn-info按钮</button>
  23. <button type="button" class="btn btn-warning">btn-warning按钮</button>
  24. <button type="button" class="btn btn-dark">btn-dark按钮</button>
  25. <button type="button" class="btn btn-light">btn-light按钮</button>
  26. <button type="button" class="btn btn-link">btn-link按钮</button>
  27. <br/>
  28. <button type="button" class="btn">btn按钮</button>
  29. <button type="button" class="btn btn-outline-primary">btn-primary按钮</button>
  30. <button type="button" class="btn btn-outline-secondary">btn-secondary按钮</button>
  31. <button type="button" class="btn btn-outline-success">btn-success按钮</button>
  32. <button type="button" class="btn btn-outline-info">btn-info按钮</button>
  33. <button type="button" class="btn btn-outline-warning">btn-warning按钮</button>
  34. <button type="button" class="btn btn-outline-dark">btn-dark按钮</button>
  35. <button type="button" class="btn btn-outline-light">btn-light按钮</button>
  36. <button type="button" class="btn btn-outline-link">btn-link按钮</button>
  37. <br/>
  38. <button type="button" class="btn">btn按钮</button>
  39. <button type="button" class="btn btn-outline-primary btn-lg">btn-primary按钮</button>
  40. <button type="button" class="btn btn-outline-secondary btn-lg">btn-secondary按钮</button>
  41. <button type="button" class="btn btn-outline-success btn-lg">btn-success按钮</button>
  42. <button type="button" class="btn btn-outline-info btn-lg">btn-info按钮</button>
  43. <button type="button" class="btn btn-outline-warning btn-lg">btn-warning按钮</button>
  44. <button type="button" class="btn btn-outline-dark btn-lg">btn-dark按钮</button>
  45. <button type="button" class="btn btn-outline-light btn-lg">btn-light按钮</button>
  46. <button type="button" class="btn btn-outline-link btn-lg">btn-link按钮</button>
  47. <br/>
  48. <button type="button" class="btn">btn按钮</button>
  49. <button type="button" class="btn btn-outline-primary btn-lg btn-block">btn-primary按钮</button>
  50. <button type="button" class="btn btn-outline-secondary btn-lg btn-block">btn-secondary按钮</button>
  51. <button type="button" class="btn btn-outline-success btn-lg btn-block">btn-success按钮</button>
  52. <button type="button" class="btn btn-outline-info btn-lg btn-block">btn-info按钮</button>
  53. <button type="button" class="btn btn-outline-warning btn-lg btn-block">btn-warning按钮</button>
  54. <button type="button" class="btn btn-outline-dark btn-lg btn-block">btn-dark按钮</button>
  55. <button type="button" class="btn btn-outline-light btn-lg btn-block">btn-light按钮</button>
  56. <button type="button" class="btn btn-outline-link btn-lg btn-block">btn-link按钮</button>
  57. <br/>
  58. <button type="button" class="btn btn-outline-primary btn-lg btn-block active">btn-primary按钮</button>
  59. <button type="button" class="btn btn-outline-secondary btn-lg btn-block" disabled>btn-secondary按钮</button>
  60. <br/>
  61. <button class="btn btn-primary">
  62. <span class="spinner-border spinner-border-sm"></span>
  63. </button>
  64. <button class="btn btn-primary">
  65. <span class="spinner-border spinner-border-sm"></span>
  66. Loading...
  67. </button>
  68. <button class="btn btn-primary">
  69. <span class="spinner-grow spinner-grow-sm"></span>
  70. Loading...
  71. </button>
  72. </div>
  73. </body>
  74. </html>

解释:

①span中的一个类是spinner-border和sprnner-graw分别代表的效果:

②使用BootStrap的button属性时,要用btn类,后面再接各种不同的类样式。

相关文章

最新文章

更多