.no-underline { text-decoration: none; color: inherit; } .no-underline:hover { text-decoration: none; } .logo { width: 40px; height: 40px; margin-right: 15px; object-fit: contain; } .title { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif; font-size: 1.8rem; font-weight: 600; letter-spacing: 0.02em; color: #6366F1; /* 使用与图片中紫色渐变相近的颜色 */ transition: color 0.2s ease; } .logo-title-container { display: flex; align-items: center; animation: fadeIn 0.5s ease-in-out; } .logo-title-container .title { display: flex; align-items: center; } .logo-title-container:hover .title { color: #4F46E5; /* 悬停时稍微深一点的紫色 */ } /* 添加一个简单的动画效果 */ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } /* 为移动设备优化 */ @media (max-width: 768px) { .title { font-size: 1.3rem; } } header nav { display: flex; align-items: center; padding: 10px 20px; } .menu-items { display: flex; align-items: center; margin-left: 40px; /* 调整导航菜单与标题之间的距离 */ } .menu-items a { color: #4B5563; text-decoration: none; font-size: 1.2rem; font-weight: 500; padding: 0.5rem 0; position: relative; transition: color 0.3s ease; } .menu-items a:hover { color: #4F46E5; /* 悬停时的颜色,稍深的紫色 */ } .menu-items a.active { color: #6366F1; /* 高亮颜色,与网站主题一致 */ font-weight: bold; border-bottom: 2px solid #6366F1; /* 添加下划线高亮 */ } .right-container { display: flex; align-items: center; margin-left: auto; /* 将右侧容器推到最右边 */ } .right-container > * { margin-left: 15px; } .auth-container { display: flex; align-items: center; } .user-info { display: flex; align-items: center; } .user-info span { margin-right: 10px; } .user-info button { padding: 5px 10px; cursor: pointer; } @media (max-width: 768px) { .right-container { flex-direction: column; align-items: flex-end; } .right-container > * { margin-left: 0; margin-top: 10px; } } /* 头像容器 */ .avatar-container { position: relative; display: inline-block; } /* 用户头像 */ .avatar { width: 32px; height: 32px; border-radius: 50%; cursor: pointer; } /* 下拉菜单 */ .dropdown-menu { position: absolute; top: 100%; /* 紧贴在头像下方 */ left: 50%; transform: translateX(-50%); margin-top: 5px; /* 可选:头像和菜单之间的间距 */ background-color: white; border: 1px solid #ccc; padding: 10px; min-width: 100px; /* 可选:设置最小宽度 */ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); z-index: 1000; } /* 下拉菜单中的按钮 */ .dropdown-menu button { background: none; border: none; cursor: pointer; font-size: 16px; color: #333; } .dropdown-menu button:hover { color: #007bff; } /* 调整导航栏布局 */ header nav { display: flex; align-items: center; padding: 10px 20px; } .right-container { margin-left: auto; /* 将右侧容器推到最右边 */ display: flex; align-items: center; } /* 导航栏基础样式 */ header { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255, 255, 255, 0.1); } header nav { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; padding: 0.8rem 1.5rem; } /* Logo和标题容器 */ .logo-title-container { display: flex; align-items: center; gap: 0.8rem; } .logo { width: 35px; height: 35px; transition: transform 0.3s ease; } .logo:hover { transform: scale(1.05); } .title { font-size: 1.8rem; font-weight: 600; background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: 0.02em; } /* 导航菜单 */ .menu-items { display: flex; align-items: center; margin-left: 3rem; gap: 2rem; } .menu-items a { color: #4B5563; text-decoration: none; font-size: 1.2rem; font-weight: 500; padding: 0.5rem 0; position: relative; transition: color 0.3s ease; } .menu-items a:hover { color: #6366F1; } .menu-items a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%); transition: width 0.3s ease; } .menu-items a:hover::after { width: 100%; } .menu-items a.active { color: #6366F1; } .menu-items a.active::after { width: 100%; } /* 右侧容器 */ .right-container { margin-left: auto; display: flex; align-items: center; gap: 1.5rem; } /* 用户头像和下拉菜单 */ .avatar-container { position: relative; } .avatar { width: 35px; height: 35px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all 0.3s ease; } .avatar:hover { border-color: #6366F1; transform: scale(1.05); } .dropdown-menu { position: absolute; top: 120%; right: 0; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); border-radius: 8px; padding: 0.5rem; min-width: 120px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); opacity: 0; transform: translateY(-10px); transition: all 0.3s ease; pointer-events: none; } .dropdown-menu.active { opacity: 1; transform: translateY(0); pointer-events: auto; } .dropdown-menu button { width: 100%; padding: 0.6rem 1rem; background: none; border: none; color: #4B5563; font-size: 0.9rem; text-align: left; cursor: pointer; border-radius: 4px; transition: all 0.2s ease; } .dropdown-menu button:hover { background: rgba(99, 102, 241, 0.1); color: #6366F1; } /* 响应式设计 */ @media (max-width: 768px) { .menu-items { display: none; } .right-container { gap: 1rem; } } /* 登录按钮样式 */ .auth-container .login-button { background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%); color: white; padding: 8px 20px; border-radius: 8px; font-size: 0.95rem; font-weight: 500; text-decoration: none; transition: all 0.3s ease; border: none; display: inline-flex; align-items: center; gap: 8px; } .auth-container .login-button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2); background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%); } /* 头像和下拉菜单样式优化 */ .avatar-container { position: relative; cursor: pointer; } .avatar { width: 35px; height: 35px; border-radius: 50%; border: 2px solid transparent; transition: all 0.3s ease; } .avatar:hover { border-color: #6366F1; transform: scale(1.05); } .dropdown-menu { position: absolute; top: calc(100% + 8px); right: 0; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); border-radius: 8px; padding: 8px 0; min-width: 150px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.3s ease; } .dropdown-menu.active { opacity: 1; visibility: visible; transform: translateY(0); } .dropdown-menu button { width: 100%; padding: 8px 16px; background: none; border: none; color: #4B5563; font-size: 0.95rem; text-align: left; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; gap: 8px; } .dropdown-menu button:hover { background: rgba(99, 102, 241, 0.1); color: #6366F1; } @media screen and (max-width: 768px) { header { height: auto; padding: 0; } header nav { padding: 0.6rem 1rem; } .logo { width: 30px; height: 30px; } .title { font-size: 1.4rem; } .menu-items { position: fixed; top: 60px; left: 0; right: 0; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); padding: 1rem; flex-direction: column; gap: 1rem; border-bottom: 1px solid rgba(99, 102, 241, 0.1); display: none; } .menu-items.active { display: flex; } .menu-items a { width: 100%; text-align: center; padding: 0.8rem; } .right-container { gap: 0.8rem; } .auth-container .login-button { padding: 6px 12px; font-size: 0.9rem; } } /* 移动端菜单按钮 */ .mobile-menu-button { display: none; background: none; border: none; padding: 8px; cursor: pointer; color: #4B5563; transition: color 0.3s ease; } .mobile-menu-button:hover { color: #6366F1; } /* 移动端适配 */ @media screen and (max-width: 768px) { header { position: fixed; top: 0; left: 0; right: 0; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); z-index: 1000; } header nav { padding: 0.8rem 1rem; justify-content: space-between; align-items: center; } .mobile-menu-button { display: block; z-index: 1001; } .menu-container { position: fixed; top: 60px; /* 导航栏高度 */ left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, 0.98); padding: 1rem; transform: translateX(100%); transition: transform 0.3s ease; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; z-index: 1000; } .menu-container.mobile-menu-open { transform: translateX(0); } .menu-items { display: flex; flex-direction: column; margin: 0; width: 100%; gap: 0.5rem; } .menu-items a { width: 100%; padding: 1rem; text-align: center; } .right-container { margin-top: 1rem; width: 100%; } } /* 横屏模式优化 */ @media screen and (max-width: 768px) and (orientation: landscape) { .menu-container { top: 50px; } .menu-items { flex-direction: row; flex-wrap: wrap; justify-content: center; } .menu-items a { width: auto; } .right-container { flex-direction: row; justify-content: center; } } /* 移动端样式统一处理 */ @media screen and (max-width: 768px) { header { position: fixed; top: 0; left: 0; right: 0; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); z-index: 1000; } header nav { padding: 0.8rem 1rem; justify-content: space-between; align-items: center; } .mobile-menu-button { display: block; z-index: 1001; background: none; border: none; padding: 8px; cursor: pointer; color: #4B5563; transition: color 0.3s ease; } .mobile-menu-button:hover { color: #6366F1; } .menu-container { position: fixed; top: 60px; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, 0.98); backdrop-filter: blur(10px); padding: 1rem; transform: translateX(100%); transition: transform 0.3s ease; z-index: 999; display: flex; flex-direction: column; overflow-y: auto; } .menu-container.mobile-menu-open { transform: translateX(0); } .menu-items { display: flex; flex-direction: column; margin: 0; width: 100%; gap: 1rem; } .menu-items a { width: 100%; text-align: center; padding: 1rem; font-size: 1.1rem; } .right-container { margin-top: 1rem; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1rem; } .auth-container { width: 100%; display: flex; justify-content: center; } .login-button { width: 100%; justify-content: center; } } /* 横屏模式优化 */ @media screen and (max-width: 768px) and (orientation: landscape) { .menu-container { top: 50px; } .menu-items { flex-direction: row; flex-wrap: wrap; justify-content: center; } .menu-items a { width: auto; } .right-container { flex-direction: row; justify-content: center; } } /* 移动端菜单按钮 */ .mobile-menu-button { display: none; background: none; border: none; padding: 8px; cursor: pointer; color: #4B5563; transition: color 0.3s ease; } /* 移动端菜单容器 */ .menu-container { display: flex; align-items: center; flex: 1; } @media screen and (max-width: 768px) { .mobile-menu-button { display: block; } .menu-container { position: fixed; top: 60px; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, 0.98); padding: 1rem; transform: translateX(100%); transition: transform 0.3s ease; z-index: 999; display: flex; flex-direction: column; } .menu-container.mobile-menu-open { transform: translateX(0); } .menu-items { display: flex !important; /* 覆盖之前的 display: none */ flex-direction: column; margin: 0; width: 100%; gap: 1rem; } .menu-items a { width: 100%; text-align: center; padding: 1rem; } .right-container { margin-top: 1rem; width: 100%; } } /* 横屏模式优化 */ @media screen and (max-width: 768px) and (orientation: landscape) { .menu-container { top: 50px; } .menu-items { flex-direction: row; flex-wrap: wrap; justify-content: center; } .menu-items a { width: auto; } }