header.css 4.4 KB

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