language_switch.css 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /* 中英文切换UI样式 - 简洁的 "中文 | English" 格式 */
  2. .language-switch {
  3. position: relative;
  4. display: flex;
  5. justify-content: center;
  6. align-items: center;
  7. margin: 0 auto;
  8. padding: 4px 12px;
  9. background: transparent;
  10. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  11. font-size: 13px;
  12. border: none;
  13. height: 100%; /* 确保填充容器高度 */
  14. }
  15. .language-switch__container {
  16. display: flex;
  17. align-items: center;
  18. gap: 6px;
  19. height: 100%; /* 确保填充容器高度 */
  20. }
  21. .language-switch__option {
  22. padding: 3px 6px;
  23. cursor: pointer;
  24. transition: all 0.3s ease;
  25. font-size: 13px;
  26. font-weight: 500;
  27. color: rgba(255, 255, 255, 0.7);
  28. background: transparent;
  29. border: none;
  30. outline: none;
  31. user-select: none;
  32. border-radius: 10px;
  33. line-height: 1.2; /* 确保文本垂直居中 */
  34. }
  35. .language-switch__option:hover {
  36. color: rgba(255, 255, 255, 0.9);
  37. background: rgba(255, 255, 255, 0.1);
  38. }
  39. .language-switch__option.active {
  40. color: #ffffff;
  41. font-weight: 600;
  42. background: rgba(255, 255, 255, 0.2);
  43. }
  44. .language-switch__separator {
  45. color: rgba(255, 255, 255, 0.5);
  46. font-weight: 300;
  47. user-select: none;
  48. }
  49. /* 语言切换容器样式 - 使用深灰色背景 */
  50. .language-switch-container {
  51. position: absolute;
  52. bottom: 0;
  53. left: 0;
  54. right: 0;
  55. background: #1a1a1a; /* 深灰色背景替代蓝色 */
  56. border-top: 1px solid rgba(255, 255, 255, 0.05);
  57. z-index: 20;
  58. padding: 0; /* 移除内边距,使用内部元素控制间距 */
  59. margin: 0;
  60. height: 36px; /* 固定高度确保一致性 */
  61. display: flex;
  62. align-items: center; /* 垂直居中 */
  63. justify-content: center; /* 水平居中 */
  64. box-sizing: border-box;
  65. }
  66. /* 响应式设计 */
  67. @media (max-width: 768px) {
  68. .language-switch {
  69. margin: 0;
  70. padding: 0 8px;
  71. }
  72. .language-switch__option {
  73. padding: 4px 8px;
  74. font-size: 12px;
  75. min-width: 40px;
  76. }
  77. .language-switch-container {
  78. height: 32px; /* 移动端更小的高度 */
  79. }
  80. }
  81. /* 在侧边栏中的样式调整 */
  82. .wy-nav-side .language-switch {
  83. margin: 0;
  84. background: transparent;
  85. position: relative;
  86. padding: 0;
  87. width: 100%;
  88. }
  89. .wy-nav-side .language-switch__container {
  90. background: transparent;
  91. border: none;
  92. padding: 0 10px;
  93. display: flex;
  94. align-items: center;
  95. justify-content: center;
  96. gap: 6px;
  97. width: 100%;
  98. }
  99. /* 优化语言切换按钮样式 */
  100. .wy-nav-side .language-switch__option {
  101. color: #ffffff;
  102. background: transparent;
  103. border: none;
  104. padding: 4px 8px;
  105. border-radius: 0;
  106. cursor: pointer;
  107. transition: all 0.2s ease;
  108. font-size: 11px !important;
  109. font-weight: 600;
  110. min-width: 40px;
  111. text-align: center;
  112. }
  113. .wy-nav-side .language-switch__option:hover {
  114. color: rgba(255, 255, 255, 0.8);
  115. background: transparent;
  116. }
  117. .wy-nav-side .language-switch__option.active {
  118. color: #ffffff;
  119. background: transparent;
  120. font-weight: 600;
  121. text-decoration: underline;
  122. }
  123. .wy-nav-side .language-switch__separator {
  124. color: rgba(255, 255, 255, 0.6);
  125. font-weight: 300;
  126. user-select: none;
  127. font-size: 11px;
  128. }
  129. /* 动画效果 */
  130. .language-switch__option {
  131. transition: color 0.3s ease, font-weight 0.3s ease;
  132. }
  133. /* 焦点状态 */
  134. .language-switch__option:focus {
  135. outline: 1px solid #666;
  136. outline-offset: 1px;
  137. }
  138. /* 禁用状态 */
  139. .language-switch__option:disabled {
  140. opacity: 0.5;
  141. cursor: not-allowed;
  142. }
  143. /* 加载状态 */
  144. .language-switch.loading .language-switch__option {
  145. pointer-events: none;
  146. opacity: 0.7;
  147. }