diff --git a/customize/custom-scripts.mdx b/customize/custom-scripts.mdx index bd2c418be..3ac3af4eb 100644 --- a/customize/custom-scripts.mdx +++ b/customize/custom-scripts.mdx @@ -413,6 +413,52 @@ Multiple instances of these elements can appear on a page. Use these as `value` +### Change the sidebar width + +Set the `--sidebar-width` CSS variable to change the width of the sidebar on desktop. The content area, header, and footer adjust to the new width, so you don't need to override `#sidebar` or offset other elements yourself. + +```css style.css +:root { + --sidebar-width: 20rem; +} +``` + +If you don't set the variable, each theme uses its default sidebar width: + +| Theme | Default width | +| :--- | :--- | +| Mint, Linden, Willow, Aspen, Sequoia | `18rem` | +| Maple, Palm | `19rem` | +| Almond | `16.5rem` | +| Luma | `14rem` | + +In the Palm theme, the variable sets the width of the expanded sidebar. The collapsed sidebar keeps its fixed width. + +### Change the content width + +Set the `--content-width` CSS variable to change the maximum width of the text column on pages that use the default [page mode](/organize/pages#page-mode). The value sets the width of the text itself. Each theme adds its own padding around the text, so the same value produces the same text width in every theme. + +```css style.css +:root { + --content-width: 768px; +} +``` + +The text column never grows wider than the space between the sidebar and the table of contents. If you set a large value, the column fills the available space without overlapping other elements. + +If you don't set the variable, each theme uses its default content width: + +| Theme | Default width | +| :--- | :--- | +| Mint, Palm, Aspen | No maximum. The text fills the available space. | +| Linden | No maximum on smaller screens. `35.75rem` on extra-large screens. | +| Maple | `36rem`. `42rem` on the largest screens. | +| Willow | `600px` | +| Almond | `36rem` | +| Sequoia, Luma | `40.5rem` | + +`--content-width` does not affect pages in `wide`, `center`, `custom`, or `frame` mode. + ## Custom JavaScript Custom JavaScript lets you add custom executable code globally. It is the equivalent of adding a `