BootStrap笔记-列表组的使用

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

运行截图如下:

代码如下:

  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. <ul class="list-group">
  19. <li class="list-group-item">First item</li>
  20. <li class="list-group-item">Second item</li>
  21. <li class="list-group-item">Third item</li>
  22. </ul>
  23. <br/>
  24. <ul class="list-group">
  25. <li class="list-group-item active">First item</li>
  26. <li class="list-group-item">Second item</li>
  27. <li class="list-group-item">Third item</li>
  28. </ul>
  29. <br/>
  30. <ul class="list-group">
  31. <li class="list-group-item disabled">First item</li>
  32. <li class="list-group-item">Second item</li>
  33. <li class="list-group-item">Third item</li>
  34. </ul>
  35. <br/>
  36. <div class="list-group">
  37. <a href="#" class="list-group-item list-group-item-action">First item</a>
  38. <a href="#" class="list-group-item list-group-item-action">Second item</a>
  39. <a href="#" class="list-group-item list-group-item-action">Third item</a>
  40. </div>
  41. <br/>
  42. <ul class="list-group list-group-flush">
  43. <li class="list-group-item disabled">First item</li>
  44. <li class="list-group-item">Second item</li>
  45. <li class="list-group-item">Third item</li>
  46. </ul>
  47. <br/>
  48. <!-- 水平列表组-->
  49. <ul class="list-group list-group-horizontal">
  50. <li class="list-group-item disabled">First item</li>
  51. <li class="list-group-item">Second item</li>
  52. <li class="list-group-item">Third item</li>
  53. </ul>
  54. <br/>
  55. <div class="list-group">
  56. <a href="#" class="list-group-item list-group-item-action">Item 1</a>
  57. <a href="#" class="list-group-item list-group-item-success">Item 2</a>
  58. <a href="#" class="list-group-item list-group-item-danger">Item 3</a>
  59. <a href="#" class="list-group-item list-group-item-info">Item 4</a>
  60. <a href="#" class="list-group-item list-group-item-warning">Item 5</a>
  61. </div>
  62. </div>
  63. </body>
  64. </html>

解释:

①创建列表组有2种方式,一种是在ul上架list-group类,然后在li上架list-group-item,或者在div上架group类,在a上架list-group-item;

②active来设置激活状态的列表;

③list-group-flush来删除列表的边框和圆角;

相关文章

最新文章

更多