# Docs Page Layout

> A three-column docs layout: sticky nav, a readable article column and an on-page TOC that hide in steps.

- Category: [CSS Layouts](https://copy-css.com/category/layouts)
- Tags: documentation, three column, table of contents, sticky, readable width
- Live preview: https://copy-css.com/snippets/docs-layout
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="docs-layout">
  <nav class="docs-layout-nav">Nav</nav>
  <main class="docs-layout-main">Article</main>
  <aside class="docs-layout-toc">On this page</aside>
</div>
```

## CSS

```css
.docs-layout {
  --nav: 220px;
  --content: 72ch;
  --toc: 200px;
  display: grid;
  grid-template-columns: var(--nav) minmax(0, var(--content)) var(--toc);
  justify-content: center;
  align-items: start;
  gap: 32px;
}

.docs-layout-nav,
.docs-layout-toc {
  position: sticky;
  top: 24px;
}

/* Medium screens: drop the table of contents */
@media (max-width: 1100px) {
  .docs-layout {
    grid-template-columns: var(--nav) minmax(0, var(--content));
  }

  .docs-layout-toc {
    display: none;
  }
}

/* Phones: article only (show the nav from a menu button) */
@media (max-width: 760px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-layout-nav {
    display: none;
  }
}
```

## Notes

- This CSS Docs Page Layout is 38 lines of pure CSS (0.7 KB) with no JavaScript and no dependencies. It uses CSS Grid, sticky positioning and custom properties.
- Customize with: `--nav`, `--content`, `--toc`.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
