.header { padding: 0px 10px 0px 10px; display: flex; height: 80px; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); text-align: center; } .logo { border: 1px solid #ddd; border-radius: 8px; } .header-left { display: flex; flex: 0 0 auto; /* 两侧不伸缩,保持内容宽度 */ flex-direction: row; justify-content: space-around; align-items: center; } .header-center { display: flex; flex: 1; /* 中间部分占据剩余空间 */ flex-direction: row; justify-content: space-evenly; align-items: center; } .header-right { display: flex; flex: 0 0 auto; /* 两侧不伸缩,保持内容宽度 */ flex-direction: row; justify-content: space-around; align-items: center; } .header-right-btn { margin-left: 10px; text-decoration: none; color:black; padding: 10px; } .header-right-btn:hover { background-color: #e5e5e5; } .menu { color: black; font-size: 18px; font-weight: bold; cursor: pointer; text-decoration: none; } .pc-dropdown { position: relative; display: inline-block; z-index: 200; } /* 下拉内容初始隐藏 */ .pc-dropdown-content { display: none; position: absolute; background-color: #ffffff; font-size: 16px; font-weight: lighter; min-width: 200px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } /* 下拉菜单项样式 */ .pc-dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; } .pc-dropdown-content a.selected { color: black; font-weight: bold; font-size: 18px; } /* 鼠标悬停时改变按钮文字颜色 */ .menu:hover { color: #3e8eff; /* 改变字体颜色 */ transition: color 0.3s ease; /* 添加颜色过渡效果 */ text-decoration: underline; } /* 鼠标悬停时显示下拉菜单 */ .menu:hover .pc-dropdown-content { display: block; } /* 下拉菜单项悬停效果 */ .pc-dropdown-content a:hover { color: #3e8eff; } /**************** 手机端的下拉框效果 **************/ .dropdown { position: relative; display: inline-block; z-index: 200; } .dropdown-content { display: none; position: absolute; right: -30px; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; } .dropdown-content a.selected { background-color: #e5e5e5; } .dropdown-content a:hover { background-color: #f1f1f1; } .dropdown:hover .dropdown-content { display: block; } .dropdown:hover .dropbtn { background-color: #e5e5e5; } /******************首页的下拉样式****************/ .dropdown-home-content { display: none; position: absolute; padding: 20px 0px 20px 0px; background-color: #2e3030; min-width: 160px; z-index: 1; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } .dropdown-home-content a { color: #c5c7c6; padding: 12px 16px; text-decoration: none; display: block; } .dropdown-home-content a.selected { color: #e0ffef; font-weight: bold; font-size: 18px; } .dropdown-home-content a:hover { background-color: #47494a; } .dropdown:hover .dropdown-home-content { display: block; } .divider { height: 1px; /* 设置高度为1像素 */ background-color: #47494a; /* 设置背景颜色为黑色 */ margin: 5px auto; /* 设置上下外边距 */ width: 80%; } .copyright { color: #888888; font-size: 12px; padding-left: 16px; } /* 默认隐藏搜索框 */ .search-container { display: none; } /* 当屏幕宽度大于768px时 */ @media (min-width: 768px) { .mobi-only { display: none; } .search-container { display: block; max-width: 500px; min-width: 300px; /* margin: 0 auto; padding: 16px; */ } .search-box { display: flex; width: 100%; border-radius: 8px; overflow: hidden; } .search-box input[type="text"] { flex-grow: 1; padding: 8px; border: none; outline: none; background-color: #f6f6f6; } .search-box button { padding: 8px; cursor: pointer; background-color: #f6f6f6; border: none; border-radius: 0 4px 4px 0; transition: background-color 0.3s; } .search-box button:hover { background-color: lightblue; } } /* for mobile */ @media (max-width: 768px) { .header-center { display: none; } }