//:root { // .vp-sidebar-item { // &[data-level='1'] { color: #3eaf7c } // &[data-level='2'] { color: #f09d51 } // } //} .vp-sidebar{ width: 22rem; } .vp-sidebar-items{ margin-left: 1.25rem; width: 80%; } .vp-sidebar-children { .vp-sidebar-children { .vp-sidebar-item { padding: 0; } } } .vp-sidebar-item { margin-bottom: 0.625rem!important; padding-left: 1.25rem!important; line-height: 2.5rem!important; } .vp-sidebar-item.auto-link:hover, .vp-sidebar-item.active:not(p.vp-sidebar-heading){ color: #000; background: #f8f8f8; border: none; border-radius: 0.625rem; } .vp-sidebar{ scrollbar-color: #999 #e2e2e3; } .vp-navbar-dropdown-item{ color: var(--vp-c-text); } // ========== 核心修改1:优化原有移动端样式,新增搜索框适配 ========== @media (max-width: 719px){ .vp-navbar-item .auto-link:hover, .vp-navbar-item .auto-link .auto-link-active{ color: #000; } .vp-sidebar-item.auto-link:hover, .vp-sidebar-item.active:not(p.vp-sidebar-heading){ color: #000; background: #f8f8f8; border: none; border-radius: 0.625rem; } .vp-sidebar{ scrollbar-color: #999 #e2e2e3; } // 移动端搜索框适配:避免覆盖标题 .search-box { //width: 150px !important; // 移动端固定窄宽度,不挤压标题 //flex: none !important; // 取消flex:1,避免占满空间 //margin-left: auto; // 靠右显示,远离标题 } .search-box input { padding-inline: 1rem !important; // 减少移动端内边距,节省空间 font-size: 0.875rem; // 缩小字体,适配窄宽度 } // 确保移动端导航栏标题不被遮挡 .vp-navbar-title { display: block !important; max-width: 120px !important; // 给标题预留足够宽度 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } // 调整导航栏布局,标题和搜索框横向排列不重叠 .vp-navbar-content { display: flex; align-items: center; justify-content: space-between; width: 100%; } } // ================================================================ .route-link-active{ color: #299764!important; border-bottom: 2px solid #299764; font-weight: 500; } .vp-navbar-item.active { color: #299764; border-bottom: 2px solid #299764; font-weight: 500; } .vp-navbar-item:hover { color: #299764; } // ========== 核心修改2:优化PC端搜索框样式,区分移动端 ========== // PC端搜索框样式(720px以上) @media (min-width: 720px) { .search-box { flex: 1 !important; // PC端占满剩余宽度 max-width: 400px !important; // 限制最大宽度 } .search-box input{ padding-inline: 2rem!important; width: 100% !important; box-sizing: border-box; } .search-result { width: inherit !important; max-width: 100%; } } // ================================================================ // 水印样式兼容:确保不被侧边栏/导航栏遮挡 .watermark-container { z-index: 9999 !important; &:not(.vp-sidebar):not(.vp-navbar) { pointer-events: none !important; } } // 深色主题适配(如果后续开启深色模式,保留这段) body.dark .watermark-content::before { color: #ffffff !important; opacity: 0.2 !important; }