version_menu.css 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /* Read the Docs 风格的版本菜单样式 */
  2. .rtd-version-menu {
  3. position: relative;
  4. display: block;
  5. margin: 4px auto;
  6. width: calc(30% - 6px);
  7. text-align: center;
  8. }
  9. /* 项目标题字体大小调整 */
  10. .wy-nav-side .icon.icon-home {
  11. font-size: 19px;
  12. font-weight: 650;
  13. margin-top: 8px;
  14. margin-bottom: 2px;
  15. }
  16. .rtd-version-menu__button {
  17. background: #f8f9fa;
  18. border: 1px solid #dee2e6;
  19. border-radius: 3px;
  20. color: #495057;
  21. cursor: pointer;
  22. display: flex;
  23. align-items: center;
  24. justify-content: space-between;
  25. font-size: 11px;
  26. font-weight: 500;
  27. line-height: 14px;
  28. padding: 4px 8px;
  29. position: relative;
  30. transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  31. white-space: nowrap;
  32. width: 100%;
  33. min-width: 80px;
  34. margin: 0 auto;
  35. }
  36. .rtd-version-menu__button:hover {
  37. border-color: #0969da;
  38. box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
  39. background: #e9ecef;
  40. }
  41. .rtd-version-menu__button:focus {
  42. border-color: #0969da;
  43. box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
  44. outline: none;
  45. }
  46. .rtd-version-menu__button::after {
  47. content: "";
  48. border: 2px solid transparent;
  49. border-top-color: currentColor;
  50. margin-left: 4px;
  51. transition: transform 0.15s ease-in-out;
  52. flex-shrink: 0;
  53. }
  54. .rtd-version-menu__button[aria-expanded="true"]::after {
  55. transform: rotate(180deg);
  56. }
  57. .rtd-version-menu__dropdown {
  58. background: #ffffff;
  59. border: 1px solid #d0d7de;
  60. border-radius: 3px;
  61. box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
  62. display: none;
  63. left: 50%;
  64. margin-top: 2px;
  65. min-width: 100%;
  66. padding: 2px 0;
  67. position: absolute;
  68. top: 100%;
  69. z-index: 1000;
  70. width: 100%;
  71. transform: translateX(-50%);
  72. }
  73. .rtd-version-menu__dropdown.show {
  74. display: block;
  75. }
  76. .rtd-version-menu__item {
  77. background: transparent;
  78. border: 0;
  79. color: #24292f;
  80. cursor: pointer;
  81. display: block;
  82. font-size: 11px;
  83. line-height: 14px;
  84. padding: 4px 10px;
  85. text-align: left;
  86. text-decoration: none;
  87. width: 100%;
  88. white-space: nowrap;
  89. }
  90. .rtd-version-menu__item:hover {
  91. background-color: #f6f8fa;
  92. color: #24292f;
  93. text-decoration: none;
  94. }
  95. .rtd-version-menu__item:focus {
  96. background-color: #f6f8fa;
  97. color: #24292f;
  98. outline: none;
  99. text-decoration: none;
  100. }
  101. .rtd-version-menu__item.active {
  102. background-color: #0969da;
  103. color: #ffffff;
  104. }
  105. .rtd-version-menu__item.active:hover {
  106. background-color: #0858b9;
  107. color: #ffffff;
  108. }
  109. /* 响应式设计 */
  110. @media (max-width: 768px) {
  111. .rtd-version-menu {
  112. margin: 2px auto;
  113. width: calc(50% - 8px);
  114. }
  115. .rtd-version-menu__button {
  116. font-size: 10px;
  117. padding: 3px 6px;
  118. }
  119. .rtd-version-menu__item {
  120. font-size: 10px;
  121. padding: 3px 8px;
  122. }
  123. /* 移动端项目标题字体大小 */
  124. .wy-nav-side .icon.icon-home {
  125. font-size: 12px;
  126. }
  127. }
  128. /* 深色主题支持 */
  129. @media (prefers-color-scheme: dark) {
  130. .rtd-version-menu__button {
  131. background: #21262d;
  132. border-color: #30363d;
  133. color: #f0f6fc;
  134. }
  135. .rtd-version-menu__button:hover {
  136. border-color: #58a6ff;
  137. box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.1);
  138. background: #30363d;
  139. }
  140. .rtd-version-menu__dropdown {
  141. background: #21262d;
  142. border-color: #30363d;
  143. box-shadow: 0 8px 24px rgba(1, 4, 9, 0.3);
  144. }
  145. .rtd-version-menu__item {
  146. color: #f0f6fc;
  147. }
  148. .rtd-version-menu__item:hover {
  149. background-color: #30363d;
  150. color: #f0f6fc;
  151. }
  152. .rtd-version-menu__item.active {
  153. background-color: #58a6ff;
  154. color: #0d1117;
  155. }
  156. .rtd-version-menu__item.active:hover {
  157. background-color: #1f6feb;
  158. color: #0d1117;
  159. }
  160. }