header.css 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. .header {
  2. padding: 0px 10px 0px 10px;
  3. display: flex;
  4. height: 80px;
  5. justify-content: space-between;
  6. align-items: center;
  7. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  8. }
  9. .logo {
  10. border: 1px solid #ddd;
  11. border-radius: 8px;
  12. }
  13. .header-left {
  14. display: flex;
  15. flex: 0 0 auto; /* 两侧不伸缩,保持内容宽度 */
  16. flex-direction: row;
  17. justify-content: space-around;
  18. align-items: center;
  19. }
  20. .header-center {
  21. display: flex;
  22. flex: 1; /* 中间部分占据剩余空间 */
  23. flex-direction: row;
  24. justify-content: space-evenly;
  25. align-items: center;
  26. }
  27. .header-right {
  28. display: flex;
  29. flex: 0 0 auto; /* 两侧不伸缩,保持内容宽度 */
  30. flex-direction: row;
  31. justify-content: space-around;
  32. align-items: center;
  33. }
  34. .header-right-btn {
  35. margin-left: 10px;
  36. text-decoration: none;
  37. color:black;
  38. padding: 10px;
  39. }
  40. .header-right-btn:hover {
  41. background-color: #e5e5e5;
  42. }
  43. .menu {
  44. color: black;
  45. font-size: 18px;
  46. font-weight: bold;
  47. cursor: pointer;
  48. text-decoration: none;
  49. }
  50. .pc-dropdown {
  51. position: relative;
  52. display: inline-block;
  53. z-index: 200;
  54. }
  55. /* 下拉内容初始隐藏 */
  56. .pc-dropdown-content {
  57. display: none;
  58. position: absolute;
  59. background-color: #ffffff;
  60. font-size: 16px;
  61. font-weight: lighter;
  62. min-width: 200px;
  63. box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  64. z-index: 1;
  65. }
  66. /* 下拉菜单项样式 */
  67. .pc-dropdown-content a {
  68. color: black;
  69. padding: 12px 16px;
  70. text-decoration: none;
  71. display: block;
  72. }
  73. .pc-dropdown-content a.selected {
  74. color: black;
  75. font-weight: bold;
  76. font-size: 18px;
  77. }
  78. /* 鼠标悬停时改变按钮文字颜色 */
  79. .menu:hover {
  80. color: #3e8eff; /* 改变字体颜色 */
  81. transition: color 0.3s ease; /* 添加颜色过渡效果 */
  82. text-decoration: underline;
  83. }
  84. /* 鼠标悬停时显示下拉菜单 */
  85. .menu:hover .pc-dropdown-content {
  86. display: block;
  87. }
  88. /* 下拉菜单项悬停效果 */
  89. .pc-dropdown-content a:hover {
  90. color: #3e8eff;
  91. }
  92. /**************** 手机端的下拉框效果 **************/
  93. .dropdown {
  94. position: relative;
  95. display: inline-block;
  96. z-index: 200;
  97. }
  98. .dropdown-content {
  99. display: none;
  100. position: absolute;
  101. right: -30px;
  102. background-color: #f9f9f9;
  103. min-width: 160px;
  104. box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  105. z-index: 1;
  106. }
  107. .dropdown-content a {
  108. color: black;
  109. padding: 12px 16px;
  110. text-decoration: none;
  111. display: block;
  112. }
  113. .dropdown-content a.selected {
  114. background-color: #e5e5e5;
  115. }
  116. .dropdown-content a:hover {
  117. background-color: #f1f1f1;
  118. }
  119. .dropdown:hover .dropdown-content {
  120. display: block;
  121. }
  122. .dropdown:hover .dropbtn {
  123. background-color: #e5e5e5;
  124. }
  125. /******************首页的下拉样式****************/
  126. .dropdown-home-content {
  127. display: none;
  128. position: absolute;
  129. padding: 20px 0px 20px 0px;
  130. background-color: #2e3030;
  131. min-width: 160px;
  132. z-index: 1;
  133. border: 1px solid #ccc;
  134. border-radius: 8px;
  135. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  136. }
  137. .dropdown-home-content a {
  138. color: #c5c7c6;
  139. padding: 12px 16px;
  140. text-decoration: none;
  141. display: block;
  142. }
  143. .dropdown-home-content a.selected {
  144. color: #e0ffef;
  145. font-weight: bold;
  146. font-size: 18px;
  147. }
  148. .dropdown-home-content a:hover {
  149. background-color: #47494a;
  150. }
  151. .dropdown:hover .dropdown-home-content {
  152. display: block;
  153. }
  154. .divider {
  155. height: 1px; /* 设置高度为1像素 */
  156. background-color: #47494a; /* 设置背景颜色为黑色 */
  157. margin: 5px auto; /* 设置上下外边距 */
  158. width: 80%;
  159. }
  160. .copyright {
  161. color: #888888;
  162. font-size: 12px;
  163. padding-left: 16px;
  164. }
  165. /* 默认隐藏搜索框 */
  166. .search-container {
  167. display: none;
  168. }
  169. /* 当屏幕宽度大于768px时 */
  170. @media (min-width: 768px) {
  171. .mobi-only {
  172. display: none;
  173. }
  174. .search-container {
  175. display: block;
  176. max-width: 500px;
  177. min-width: 300px;
  178. /* margin: 0 auto;
  179. padding: 16px; */
  180. }
  181. .search-box {
  182. display: flex;
  183. width: 100%;
  184. border-radius: 8px;
  185. overflow: hidden;
  186. }
  187. .search-box input[type="text"] {
  188. flex-grow: 1;
  189. padding: 8px;
  190. border: none;
  191. outline: none;
  192. background-color: #f6f6f6;
  193. }
  194. .search-box button {
  195. padding: 8px;
  196. cursor: pointer;
  197. background-color: #f6f6f6;
  198. border: none;
  199. border-radius: 0 4px 4px 0;
  200. transition: background-color 0.3s;
  201. }
  202. .search-box button:hover {
  203. background-color: lightblue;
  204. }
  205. }
  206. /* for mobile */
  207. @media (max-width: 768px) {
  208. .header-center {
  209. display: none;
  210. }
  211. }