style(docs): adjust sidebar spacing and line heights for compact layout

This commit is contained in:
sanbuphy
2026-01-12 14:52:41 +08:00
parent 18f958500e
commit bc71ebd1bc
+29 -27
View File
@@ -1,38 +1,40 @@
/* Custom styles for viewerjs */
.viewer-container {
z-index: 9999 !important; /* Ensure it's above everything including navbar */
:root {
/* 调整侧边栏分组之间的间距 */
--vp-sidebar-nav-section-gap: 8px;
}
/* Optional: Adjust backdrop opacity if needed */
.viewer-backdrop {
background-color: rgba(0, 0, 0, 0.9); /* Darker backdrop for better focus */
/* 减少一级标题(如"前端开发")底部的间距 */
.VPSidebarItem.level-0 {
padding-bottom: 4px;
}
/*
Core Logic:
1. Default (opening/closing): No transition -> Instant.
2. body.viewer-ready (viewing): Force transition -> Smooth Zoom.
*/
body.viewer-ready .viewer-canvas > img {
transition: transform 0.2s ease-out !important;
/* 减少一级标题文字与下方子菜单的间距 */
.VPSidebarItem.level-0 > .item {
padding-bottom: 2px;
}
/* Limit image max height in document content */
.vp-doc img {
max-height: 500px;
width: auto;
margin: 16px auto; /* Center with spacing */
display: block;
border-radius: 8px; /* Optional: Rounded corners */
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Optional: Shadow */
/* 调整子菜单项之间的间距 */
.VPSidebarItem.level-1 .item {
padding: 2px 0;
}
/* Tall images (e.g. mobile screenshots) - ratio > 1.2 */
.vp-doc img.img-tall {
max-height: 400px;
/* 针对可能存在的特定类名进行覆盖,确保紧凑 */
.VPSidebarGroup {
padding-top: 6px;
padding-bottom: 6px;
}
/* Very tall images (e.g. long screenshots) - ratio > 2 */
.vp-doc img.img-very-tall {
max-height: 300px;
/* 进一步压缩分组标题与第一项之间的间距 */
.VPSidebarItem.level-0 + .VPSidebarItem.level-1 {
margin-top: -2px;
}
/* 压缩分组标题本身的行高 */
.VPSidebarItem.level-0 .text {
line-height: 1.3;
}
/* 压缩子项的行高 */
.VPSidebarItem.level-1 .text {
line-height: 1.4;
}