如何在CSS中更改Bootstrap下拉菜单的背景颜色和文字颜色?

huangapple go评论92阅读模式
英文:

How to change Bootstrap dropdown background color & color in CSS?

问题

以下是您提供的内容的翻译:

我一直在尝试改变下拉菜单的背景颜色和颜色,但没有成功(dropdown-menu和dropdown-item)。 现在下拉菜单的背景颜色非常浅灰色,每个项目的悬停具有中等浅灰色背景和黄色文字颜色,它们之间的对比度不高,我需要更改它们。

  1. /* 导航栏 */
  2. .navbar-nav {
  3. font-weight: bold !important;
  4. }
  5. /* 导航栏背景颜色 */
  6. .nav-item a,
  7. .nav-item a:link,
  8. .nav-item a:visited {
  9. color: var(--bodyPage) !important;
  10. }
  11. /* 导航栏项目字体颜色 */
  12. .nav-item a:hover,
  13. .nav-item a:focus {
  14. color: var(--linkHover) !important;
  15. }
  16. /* 活动导航栏项目字体颜色 */
  17. .active a,
  18. .nav-item .active a:link,
  19. .active a:visited {
  20. color: var(--navActive) !important;
  21. }
  22. /* 活动导航栏项目悬停字体颜色 */
  23. .active a:hover,
  24. .active a:focus {
  25. color: var(--linkHover) !important;
  26. }
  27. /* 链接 */
  28. a,
  29. a:link,
  30. a:visited {
  31. color: var(--link);
  32. }
  33. a:hover,
  34. a:focus {
  35. color: var(--linkHover);
  36. }
  37. .site-footer a,
  38. .site-footer a:link,
  39. .site-footer a:visited {
  40. color: var(--link);
  41. }
  42. /* 页脚链接颜色 */
  43. .site-footer a:hover,
  44. .site-footer a:focus {
  45. color: var(--linkHover);
  46. }
  47. /* 页脚悬停链接颜色 */
  48. .site-page a,
  49. .site-page a:link,
  50. .site-page a:visited {
  51. color: var(--link);
  52. }
  53. /* 页面正文链接颜色 */
  54. .site-page a:hover,
  55. .site-page a:focus {
  56. color: var(--linkHover);
  57. }
  58. /* 页面正文悬停链接颜色 */
  59. .banner a,
  60. .banner a:link,
  61. .banner a:visited {
  62. color: var(--link);
  63. }
  64. /* 横幅链接颜色 */
  65. .banner a:hover,
  66. .banner a:focus {
  67. color: var(--linkHover);
  68. }
  69. /* 横幅悬停链接颜色 */
  70. .no-banner a,
  71. .no-banner a:link,
  72. .no-banner a:visited {
  73. color: var(--link);
  74. }
  75. /* 无横幅链接颜色 */
  76. .no-banner a:hover,
  77. .no-banner a:focus {
  78. color: var(--linkHover);
  79. }
  80. /* 无横幅悬停链接颜色 */
  81. .navbar-default .navbar-toggle {
  82. background-color: red !important;
  83. }
  84. @media (max-width:992px) {
  85. .navbar-nav {
  86. background-color: black !important;
  87. padding: 8px !important;
  88. }
  89. }
  90. /* 下拉菜单 */
  91. .dropdown-menu {
  92. background-color: rgb(99, 97, 97) !important;
  93. }
  94. .dropdown-item a:hover {
  95. background-color: rgb(0, 0, 0) !important;
  96. }

希望这能帮助您更改下拉菜单的颜色和背景颜色。

英文:

I have been trying everything to change the background-color & color of the dropdown with no success (dropdown-menu & dropdown-item). Now the background color of the dropdown is very light grey and the hover on each item has a medium light grey background and a yellow color which are not very contrasted and I need to change them.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

  1. /* navbar */
  2. .navbar-nav {
  3. font-weight: bold !important;
  4. }
  5. /* navbar bgn color */
  6. .nav-item a,
  7. .nav-item a:link,
  8. .nav-item a:visited {
  9. color: var(--bodyPage) !important;
  10. }
  11. /* navbar item font color */
  12. .nav-item a:hover,
  13. .nav-item a:focus {
  14. color: var(--linkHover) !important;
  15. }
  16. /* navbar item hover font color */
  17. .active a,
  18. .nav-item .active a:link,
  19. .active a:visited {
  20. color: var(--navActive) !important;
  21. }
  22. /* active navbar item font color */
  23. .active a:hover,
  24. .active a:focus {
  25. color: var(--linkHover) !important;
  26. }
  27. /* active navbar item hover font color */
  28. /* links */
  29. a,
  30. a:link,
  31. a:visited {
  32. color: var(--link);
  33. }
  34. a:hover,
  35. a:focus {
  36. color: var(--linkHover);
  37. }
  38. .site-footer a,
  39. .site-footer a:link,
  40. .site-footer a:visited {
  41. color: var(--link);
  42. }
  43. /* footer link color */
  44. .site-footer a:hover,
  45. .site-footer a:focus {
  46. color: var(--linkHover);
  47. }
  48. /* footer hover link color */
  49. .site-page a,
  50. .site-page a:link,
  51. .site-page a:visited {
  52. color: var(--link);
  53. }
  54. /* page body link color */
  55. .site-page a:hover,
  56. .site-page a:focus {
  57. color: var(--linkHover);
  58. }
  59. /* page body hover link color */
  60. .banner a,
  61. .banner a:link,
  62. .banner a:visited {
  63. color: var(--link);
  64. }
  65. /* banner link color */
  66. .banner a:hover,
  67. .banner a:focus {
  68. color: var(--linkHover);
  69. }
  70. /* banner hover link color */
  71. .no-banner a,
  72. .no-banner a:link,
  73. .no-banner a:visited {
  74. color: var(--link);
  75. }
  76. /* no banner link color */
  77. .no-banner a:hover,
  78. .no-banner a:focus {
  79. color: var(--linkHover);
  80. }
  81. /* no banner hover link color */
  82. .navbar-default .navbar-toggle {
  83. background-color: red !important;
  84. }
  85. @media (max-width:992px) {
  86. .navbar-nav {
  87. background-color: black !important;
  88. padding: 8px !important;
  89. }
  90. }
  91. /* dropdown menu */
  92. .dropdown-menu {
  93. background-color: rgb(99, 97, 97) !important;
  94. }
  95. .dropdown-item a:hover {
  96. background-color: rgb(0, 0, 0) !important;
  97. }

<!-- language: lang-html -->

  1. &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css&quot; integrity=&quot;sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm&quot; crossorigin=&quot;anonymous&quot;&gt;
  2. &lt;script src=&quot;https://code.jquery.com/jquery-3.2.1.slim.min.js&quot; integrity=&quot;sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  3. &lt;script src=&quot;https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js&quot; integrity=&quot;sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  4. &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js&quot; integrity=&quot;sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  5. &lt;body data-spy=&quot;scroll&quot; data-target=&quot;.site-navbar-target&quot; data-offset=&quot;300&quot;&gt;
  6. &lt;div class=&quot;site-wrap&quot; id=&quot;home-section&quot;&gt;
  7. &lt;header class=&quot;container-fluid sticky site-header&quot; id=&quot;headerSite&quot;&gt;
  8. &lt;div class=&quot;container&quot;&gt;
  9. &lt;nav class=&quot;navbar navbar-expand-md navbar-light&quot;&gt;
  10. &lt;div class=&quot;collapse navbar-collapse justify-content-between&quot; id=&quot;navbarCollapse&quot;&gt;
  11. &lt;div class=&quot;navbar-nav mr-auto&quot;&gt;
  12. &lt;li class=&quot;nav-item&quot;&gt;&lt;a href=&quot;/dashboard&quot; class=&quot;nav-link&quot;&gt;Dashboard&lt;/a&gt;&lt;/li&gt;
  13. &lt;div class=&quot;nav-item dropdown&quot;&gt;
  14. &lt;a href=&quot;#&quot; class=&quot;nav-link dropdown-toggle&quot; id=&quot;dropdownNav&quot; data-bs-toggle=&quot;dropdown&quot;&gt;database&lt;/a&gt;
  15. &lt;div class=&quot;dropdown-menu&quot; aria-labelledby=&quot;dropdownNav&quot;&gt;
  16. &lt;a href=&quot;...&quot; class=&quot;dropdown-item&quot;&gt;table1&lt;/a&gt;
  17. &lt;a href=&quot;...&quot; class=&quot;dropdown-item&quot;&gt;table2&lt;/a&gt;
  18. &lt;a href=&quot;...&quot; class=&quot;dropdown-item&quot;&gt;table3&lt;/a&gt;
  19. &lt;/div&gt;
  20. &lt;/div&gt;
  21. &lt;/div&gt;
  22. &lt;/div&gt;
  23. &lt;/nav&gt;
  24. &lt;/div&gt;
  25. &lt;/header&gt;

<!-- end snippet -->

答案1

得分: 1

  1. 添加一个自定义的 CSS 文件(例如 style.css),并在 Bootstrap CSS 引用下方添加链接引用(例如 <link rel="stylesheet" href="path-to-your-css-file/style.css">

  2. 为要修改的元素添加一个新的自定义类,并根据需求设置该类的颜色。

例如: <a href="#" class="nav-link dropdown-toggle custom-dropdown" id="dropdownNav" data-bs-toggle="dropdown">database</a>

  1. 对于下拉项也可以做同样的操作。
英文:
  1. Add a custom css file (e.g. style.css) and add reference to it below your bootstrap css reference (e.g. &lt;link rel=&quot;stylesheet&quot; href=&quot;path-to-your-css-file/style.css&quot;&gt; )

  2. Add a new class to custom class to the elements you want to modify and color that class as per your requirement.

e.g. &lt;a href=&quot;#&quot; class=&quot;nav-link dropdown-toggle custom-dropdown&quot; id=&quot;dropdownNav&quot; data-bs-toggle=&quot;dropdown&quot;&gt;database&lt;/a&gt;

  1. You can do the same for dropdown-item too.

答案2

得分: 0

看起来你有一些HTML问题,我甚至无法查看你示例中的下拉菜单。这种方式对我有效,我可以看到下拉菜单中的颜色变化。不清楚你确切想要什么颜色,但这可能符合你的需求。

  1. /* 导航栏 */
  2. .navbar-nav {
  3. font-weight: bold !important;
  4. }
  5. /* 导航栏背景颜色 */
  6. .nav-item a,
  7. .nav-item a:link,
  8. .nav-item a:visited {
  9. color: var(--bodyPage) !important;
  10. }
  11. /* 导航栏项字体颜色 */
  12. .nav-item a:hover,
  13. .nav-item a:focus {
  14. color: var(--linkHover) !important;
  15. }
  16. /* 导航栏项悬停字体颜色 */
  17. .active a,
  18. .nav-item .active a:link,
  19. .active a:visited {
  20. color: var(--navActive) !important;
  21. }
  22. /* 活动导航栏项字体颜色 */
  23. .active a:hover,
  24. .active a:focus {
  25. color: var(--linkHover) !important;
  26. }
  27. /* 活动导航栏项悬停字体颜色 */
  28. /* 链接 */
  29. a,
  30. a:link,
  31. a:visited {
  32. color: var(--link);
  33. }
  34. a:hover,
  35. a:focus {
  36. color: var(--linkHover);
  37. }
  38. .site-footer a,
  39. .site-footer a:link,
  40. .site-footer a:visited {
  41. color: var(--link);
  42. }
  43. /* 页脚链接颜色 */
  44. .site-footer a:hover,
  45. .site-footer a:focus {
  46. color: var(--linkHover);
  47. }
  48. /* 页脚悬停链接颜色 */
  49. .site-page a,
  50. .site-page a:link,
  51. .site-page a:visited {
  52. color: var(--link);
  53. }
  54. /* 页面链接颜色 */
  55. .site-page a:hover,
  56. .site-page a:focus {
  57. color: var(--linkHover);
  58. }
  59. /* 页面悬停链接颜色 */
  60. .banner a,
  61. .banner a:link,
  62. .banner a:visited {
  63. color: var(--link);
  64. }
  65. /* 横幅链接颜色 */
  66. .banner a:hover,
  67. .banner a:focus {
  68. color: var(--linkHover);
  69. }
  70. /* 横幅悬停链接颜色 */
  71. .no-banner a,
  72. .no-banner a:link,
  73. .no-banner a:visited {
  74. color: var(--link);
  75. }
  76. /* 无横幅链接颜色 */
  77. .no-banner a:hover,
  78. .no-banner a:focus {
  79. color: var(--linkHover);
  80. }
  81. /* 无横幅悬停链接颜色 */
  82. .navbar-default .navbar-toggle {
  83. background-color: red !important;
  84. }
  85. @media (max-width: 992px) {
  86. .navbar-nav {
  87. background-color: black !important;
  88. padding: 8px !important;
  89. }
  90. }
  91. /* 下拉菜单 */
  92. .dropdown-menu {
  93. background-color: rgb(99, 97, 97) !important;
  94. }
  95. .dropdown-item a:hover {
  96. background-color: rgb(0, 0, 0) !important;
  97. }
英文:

It looks like you've got some HTML issues, and I wasn't able to even view the dropdown menu in your example. This way works for me, and I can see the color changed in the dropdown menu. It's not clear what colors you want exactly, but this might get you there.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

  1. /* navbar */
  2. .navbar-nav {
  3. font-weight: bold !important;
  4. }
  5. /* navbar bgn color */
  6. .nav-item a,
  7. .nav-item a:link,
  8. .nav-item a:visited {
  9. color: var(--bodyPage) !important;
  10. }
  11. /* navbar item font color */
  12. .nav-item a:hover,
  13. .nav-item a:focus {
  14. color: var(--linkHover) !important;
  15. }
  16. /* navbar item hover font color */
  17. .active a,
  18. .nav-item .active a:link,
  19. .active a:visited {
  20. color: var(--navActive) !important;
  21. }
  22. /* active navbar item font color */
  23. .active a:hover,
  24. .active a:focus {
  25. color: var(--linkHover) !important;
  26. }
  27. /* active navbar item hover font color */
  28. /* links */
  29. a,
  30. a:link,
  31. a:visited {
  32. color: var(--link);
  33. }
  34. a:hover,
  35. a:focus {
  36. color: var(--linkHover);
  37. }
  38. .site-footer a,
  39. .site-footer a:link,
  40. .site-footer a:visited {
  41. color: var(--link);
  42. }
  43. /* footer link color */
  44. .site-footer a:hover,
  45. .site-footer a:focus {
  46. color: var(--linkHover);
  47. }
  48. /* footer hover link color */
  49. .site-page a,
  50. .site-page a:link,
  51. .site-page a:visited {
  52. color: var(--link);
  53. }
  54. /* page body link color */
  55. .site-page a:hover,
  56. .site-page a:focus {
  57. color: var(--linkHover);
  58. }
  59. /* page body hover link color */
  60. .banner a,
  61. .banner a:link,
  62. .banner a:visited {
  63. color: var(--link);
  64. }
  65. /* banner link color */
  66. .banner a:hover,
  67. .banner a:focus {
  68. color: var(--linkHover);
  69. }
  70. /* banner hover link color */
  71. .no-banner a,
  72. .no-banner a:link,
  73. .no-banner a:visited {
  74. color: var(--link);
  75. }
  76. /* no banner link color */
  77. .no-banner a:hover,
  78. .no-banner a:focus {
  79. color: var(--linkHover);
  80. }
  81. /* no banner hover link color */
  82. .navbar-default .navbar-toggle {
  83. background-color: red !important;
  84. }
  85. @media (max-width:992px) {
  86. .navbar-nav {
  87. background-color: black !important;
  88. padding: 8px !important;
  89. }
  90. }
  91. /* dropdown menu */
  92. .dropdown-menu {
  93. background-color: rgb(99, 97, 97) !important;
  94. }
  95. .dropdown-item a:hover {
  96. background-color: rgb(0, 0, 0) !important;
  97. }

<!-- language: lang-html -->

  1. &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css&quot; integrity=&quot;sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO&quot; crossorigin=&quot;anonymous&quot;&gt;
  2. &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.slim.min.js&quot; integrity=&quot;sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  3. &lt;script src=&quot;https://cdn.jsdelivr.net/npm/popper.js@1.14.3/dist/umd/popper.min.js&quot; integrity=&quot;sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  4. &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/js/bootstrap.min.js&quot; integrity=&quot;sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  5. &lt;header class=&quot;site-wrap&quot; id=&quot;home-section&quot;&gt;
  6. &lt;header class=&quot;container-fluid sticky site-header&quot; id=&quot;headerSite&quot;&gt;
  7. &lt;div class=&quot;container&quot;&gt;
  8. &lt;nav class=&quot;navbar navbar-expand-lg navbar-light bg-light&quot;&gt;
  9. &lt;a class=&quot;navbar-brand&quot; href=&quot;#&quot;&gt;Navbar&lt;/a&gt;
  10. &lt;button class=&quot;navbar-toggler&quot; type=&quot;button&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#navbarSupportedContent&quot; aria-controls=&quot;navbarSupportedContent&quot; aria-expanded=&quot;false&quot; aria-label=&quot;Toggle navigation&quot;&gt;
  11. &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;
  12. &lt;/button&gt;
  13. &lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;navbarSupportedContent&quot;&gt;
  14. &lt;ul class=&quot;navbar-nav mr-auto&quot;&gt;
  15. &lt;li class=&quot;nav-item&quot;&gt;&lt;a href=&quot;/dashboard&quot; class=&quot;nav-link&quot;&gt;Dashboard&lt;/a&gt;&lt;/li&gt;
  16. &lt;li class=&quot;nav-item dropdown&quot;&gt;
  17. &lt;a class=&quot;nav-link dropdown-toggle&quot; href=&quot;#&quot; id=&quot;navbarDropdown&quot; role=&quot;button&quot; data-toggle=&quot;dropdown&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&gt;
  18. database
  19. &lt;/a&gt;
  20. &lt;div class=&quot;dropdown-menu&quot; aria-labelledby=&quot;navbarDropdown&quot;&gt;
  21. &lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;table1&lt;/a&gt;
  22. &lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;table2&lt;/a&gt;
  23. &lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;table3&lt;/a&gt;
  24. &lt;/li&gt;
  25. &lt;/ul&gt;
  26. &lt;/div&gt;
  27. &lt;/nav&gt;
  28. &lt;/div&gt;
  29. &lt;/header&gt;

<!-- end snippet -->

答案3

得分: 0

以下是您的解决方案:
现在已成功更改
我解释了我的代码注释,请检查

请使用以下代码添加到您的CSS文件或样式标签中,然后下拉菜单将更改样式:

  1. .dropdown {
  2. background-color: aqua !important;
  3. /* 这是下拉菜单的背景颜色 */
  4. }
  5. .dropdown a {
  6. color: whitesmoke !important;
  7. /* 这是下拉菜单文字颜色 */
  8. }
  9. .dropdown-menu {
  10. background-color: brown !important;
  11. /* 这是下拉菜单背景颜色 */
  12. }
  13. a.dropdown-item {
  14. color: blueviolet !important;
  15. /* 这是下拉菜单文字颜色 */
  16. }
  17. a.dropdown-item:hover {
  18. background-color: chocolate;
  19. color: seagreen !important;
  20. /* 这是下拉菜单悬停时的背景和文字颜色 */
  21. }

同时,确保在HTML中添加以下引用:

  1. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
  2. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">

这将使下拉菜单样式更改生效。

英文:

Here is your solution...
now it change successfully
i explain my to the comment of the code check please
use this code to your css file or in the style tag then the dropdown will be changed...

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

  1. .dropdown {
  2. background-color: aqua !important;
  3. /* this is for dropdown background */
  4. }
  5. .dropdown a {
  6. color: whitesmoke !important;
  7. /* this is for dropdown text color */
  8. }
  9. .dropdown-menu {
  10. background-color: brown !important;

/* this is for dropdown menu background */
}

  1. a.dropdown-item {
  2. color: blueviolet !important;

/* this is for dropdown menu text color */
}

  1. a.dropdown-item:hover {
  2. background-color: chocolate;
  3. color: seagreen !important;

/* this is for dropdown menu hover background and text color */
}

<!-- language: lang-html -->

  1. &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;
  2. &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;/&gt;
  3. &lt;nav class=&quot;navbar navbar-expand-lg bg-body-tertiary&quot;&gt;
  4. &lt;div class=&quot;container-fluid&quot;&gt;
  5. &lt;a class=&quot;navbar-brand&quot; href=&quot;#&quot;&gt;Navbar&lt;/a&gt;
  6. &lt;button class=&quot;navbar-toggler&quot; type=&quot;button&quot; data-bs-toggle=&quot;collapse&quot;
  7. data-bs-target=&quot;#navbarSupportedContent&quot; aria-controls=&quot;navbarSupportedContent&quot; aria-expanded=&quot;false&quot;
  8. aria-label=&quot;Toggle navigation&quot;&gt;
  9. &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;
  10. &lt;/button&gt;
  11. &lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;navbarSupportedContent&quot;&gt;
  12. &lt;ul class=&quot;navbar-nav me-auto mb-2 mb-lg-0&quot;&gt;
  13. &lt;li class=&quot;nav-item&quot;&gt;
  14. &lt;a class=&quot;nav-link active&quot; aria-current=&quot;page&quot; href=&quot;#&quot;&gt;Home&lt;/a&gt;
  15. &lt;/li&gt;
  16. &lt;li class=&quot;nav-item&quot;&gt;
  17. &lt;a class=&quot;nav-link&quot; href=&quot;#&quot;&gt;Link&lt;/a&gt;
  18. &lt;/li&gt;
  19. &lt;li class=&quot;nav-item dropdown&quot;&gt;
  20. &lt;a class=&quot;nav-link dropdown-toggle&quot; href=&quot;#&quot; role=&quot;button&quot; data-bs-toggle=&quot;dropdown&quot;
  21. aria-expanded=&quot;false&quot;&gt;
  22. Dropdown
  23. &lt;/a&gt;
  24. &lt;ul class=&quot;dropdown-menu&quot;&gt;
  25. &lt;li&gt;&lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;Action&lt;/a&gt;&lt;/li&gt;
  26. &lt;li&gt;&lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;Another action&lt;/a&gt;&lt;/li&gt;
  27. &lt;li&gt;
  28. &lt;hr class=&quot;dropdown-divider&quot;&gt;
  29. &lt;/li&gt;
  30. &lt;li&gt;&lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;Something else here&lt;/a&gt;&lt;/li&gt;
  31. &lt;/ul&gt;
  32. &lt;/li&gt;
  33. &lt;li class=&quot;nav-item&quot;&gt;
  34. &lt;a class=&quot;nav-link disabled&quot;&gt;Disabled&lt;/a&gt;
  35. &lt;/li&gt;
  36. &lt;/ul&gt;
  37. &lt;form class=&quot;d-flex&quot; role=&quot;search&quot;&gt;
  38. &lt;input class=&quot;form-control me-2&quot; type=&quot;search&quot; placeholder=&quot;Search&quot; aria-label=&quot;Search&quot;&gt;
  39. &lt;button class=&quot;btn btn-outline-success&quot; type=&quot;submit&quot;&gt;Search&lt;/button&gt;
  40. &lt;/form&gt;
  41. &lt;/div&gt;
  42. &lt;/div&gt;
  43. &lt;/nav&gt;

<!-- end snippet -->

huangapple
  • 本文由 发表于 2023年5月26日 00:47:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76334577.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定