|
232 | 232 | font-size: var(--vp-font-size-base); |
233 | 233 | line-height: var(--vp-line-height-relaxed); |
234 | 234 | margin: var(--vp-spacing-5) 0; |
235 | | - max-width: var(--vp-prose-width); |
| 235 | + max-width: 100%; |
236 | 236 | } |
237 | 237 |
|
238 | 238 | /* Lists with proper spacing */ |
|
242 | 242 | line-height: var(--vp-line-height-relaxed); |
243 | 243 | margin: var(--vp-spacing-5) 0; |
244 | 244 | padding-left: var(--vp-spacing-6); |
245 | | - max-width: var(--vp-prose-width); |
| 245 | + max-width: 100%; |
246 | 246 | } |
247 | 247 |
|
248 | 248 | .vp-doc li { |
@@ -837,3 +837,86 @@ textarea:focus-visible { |
837 | 837 | padding: 0 !important; |
838 | 838 | } |
839 | 839 | } |
| 840 | + |
| 841 | +/* |
| 842 | + * =================================================================== |
| 843 | + * 智能响应式内容宽度方案 (Intelligent Responsive Content Width) |
| 844 | + * =================================================================== |
| 845 | + * 目的: 根据视口宽度动态调整内容区域占比,优化空间利用。 |
| 846 | + * 原理: 使用rem单位的padding,在不同视口宽度下提供合适的留白。 |
| 847 | + * 窄屏使用较小padding,超宽屏使用较大padding。 |
| 848 | + */ |
| 849 | + |
| 850 | +/* 步骤1: 在所有桌面视图下,让.container可以填满父级空间 */ |
| 851 | +@media (min-width: 1024px) { |
| 852 | + .VPDoc.has-aside .container { |
| 853 | + max-width: none !important; |
| 854 | + width: 100% !important; |
| 855 | + margin: 0 !important; |
| 856 | + padding: 0 var(--vp-spacing-8) !important; |
| 857 | + } |
| 858 | + |
| 859 | + .VPContent.has-sidebar { |
| 860 | + margin-left: var(--vp-sidebar-width) !important; |
| 861 | + margin-right: var(--vp-toc-width) !important; |
| 862 | + width: calc(100vw - var(--vp-sidebar-width) - var(--vp-toc-width)) !important; |
| 863 | + box-sizing: border-box; |
| 864 | + } |
| 865 | +} |
| 866 | + |
| 867 | +/* 窄屏 (1024px - 1439px): 使用2rem padding */ |
| 868 | +@media (min-width: 1024px) and (max-width: 1439px) { |
| 869 | + .VPContent.has-sidebar { |
| 870 | + padding-left: 2rem !important; |
| 871 | + padding-right: 2rem !important; |
| 872 | + } |
| 873 | +} |
| 874 | + |
| 875 | +/* 标准宽屏 (1440px - 1919px): 使用3rem padding */ |
| 876 | +@media (min-width: 1440px) and (max-width: 1919px) { |
| 877 | + .VPContent.has-sidebar { |
| 878 | + padding-left: 3rem !important; |
| 879 | + padding-right: 3rem !important; |
| 880 | + } |
| 881 | +} |
| 882 | + |
| 883 | +/* 超宽屏 (>= 1920px): 使用5rem padding */ |
| 884 | +@media (min-width: 1920px) { |
| 885 | + .VPContent.has-sidebar { |
| 886 | + padding-left: 5rem !important; |
| 887 | + padding-right: 5rem !important; |
| 888 | + } |
| 889 | +} |
| 890 | + |
| 891 | +/* ============================================ |
| 892 | + * Widen Doc Content to Fill Container |
| 893 | + * ============================================ */ |
| 894 | +/* |
| 895 | + * Overrides VitePress's default readability width limit for .vp-doc |
| 896 | + * and .content-container on desktop layouts, allowing content to use |
| 897 | + * the full available space defined by the responsive padding in the |
| 898 | + * "Intelligent Responsive Content Width" section. |
| 899 | + */ |
| 900 | +@media (min-width: 1024px) { |
| 901 | + /* Expand .content to fill available space */ |
| 902 | + .VPDoc.has-aside .container .content { |
| 903 | + flex-grow: 1 !important; |
| 904 | + max-width: none !important; |
| 905 | + } |
| 906 | + |
| 907 | + /* Use multiple selectors to increase specificity and override scoped styles */ |
| 908 | + .VPDoc.has-aside .container .content-container, |
| 909 | + .VPDoc.has-aside .content-container[class], |
| 910 | + .content-container { |
| 911 | + max-width: none !important; |
| 912 | + width: 100% !important; |
| 913 | + min-width: 100% !important; |
| 914 | + flex-grow: 1 !important; |
| 915 | + flex-basis: 100% !important; |
| 916 | + } |
| 917 | + |
| 918 | + .vp-doc { |
| 919 | + max-width: 100% !important; |
| 920 | + width: 100% !important; |
| 921 | + } |
| 922 | +} |
0 commit comments