網站導覽

v2.1.0
網站頁面

聖杯版面

由頁首、三欄和頁尾組成,原始碼中以中間欄為三欄之首。

聖杯版面是最早有專名的頁面版面配置,由頁首、三欄和頁尾組成。中間欄占用兩側欄位留下的空間,三欄都和最高的一欄等高,主要內容在原始碼中排在兩側欄位之前。這種版面在長達十五年的時間裡都很難實作。它就是啟用所有選用區域的應用程式框架。

聖杯版面

<div class="shell bg-surface-base fg-text-body text-sm" style="--shell-sidebar: 13rem; --shell-aside: 15rem">  <header class="navbar shell-header bb(1) bb-solid b-line-hair" style="--navbar-padding-x: 1.25rem">    <button type="button" class="btn btn-quiet btn-square btn-sm shell-toggle" commandfor="hg-nav" command="show-modal" aria-label="Open navigation">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M3 5.5L13 5.5" /><path d="M3 10.5L13 10.5" />      </svg>    </button>    <a class="navbar-brand" href="#">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <circle cx="8" cy="8" r="6" /><path d="M8 4.3333A3.6667 3.6667 0 0 1 8 11.6667Z" fill="currentColor" stroke="none" />      </svg>Atlas    </a>    <div class="navbar-end">      <button type="button" class="btn btn-primary btn-sm">Subscribe</button>    </div>  </header>  <main class="shell-main">    <article class="flex flex-col gap-md max-w(640) mx-auto px(20) py-xl">      <p class="eyebrow">Engineering</p>      <h1 class="heading heading-2xl">How we cut cold builds by forty seconds</h1>      <p class="lead">        Most of a cold build was spent fetching what the last build had already fetched. We stopped throwing it away.      </p>      <p class="m(0) leading-md">        A build starts from an empty machine. For years that was a feature: nothing left over from last time could break this time. It also meant every build downloaded the same two hundred megabytes of dependencies before doing any work of its own.      </p>      <p class="m(0) leading-md">        The fix was not a faster download. It was to key a cache by the lockfile, restore it before the install step, and let the package manager find that it had nothing to do. The install step now takes about three seconds when nothing changed, which is most of the time.      </p>      <p class="m(0) leading-md">        The main column is first in the source, before both side columns. The grid places each region by its class, so the order a screen reader meets them in is the order of importance, not the order on screen.      </p>      <p class="m(0) leading-md">        We measured for a month before turning it on for everyone. Median cold build time went from 96 seconds to 55, and the slowest tenth improved the most, because they had the most to download.      </p>    </article>  </main>  <div class="shell-sidebar p-sm bxe(1) bxe-solid b-line-hair">    <nav class="nav" aria-label="Sections">      <a class="nav-item" href="#">Latest</a>      <a class="nav-item" href="#" aria-current="page">Engineering</a>      <a class="nav-item" href="#">Product</a>      <a class="nav-item" href="#">Company</a>      <a class="nav-item" href="#">Customers</a>    </nav>  </div>  <aside class="shell-aside gap-md px-lg py-xl bxs(1) bxs-solid b-line-hair" aria-labelledby="hg-related">    <h2 class="eyebrow" id="hg-related">More from engineering</h2>    <ul class="flex flex-col gap-md m(0) p(0)">      <li class="flex">        <a class="link link-quiet fg-text-strong" href="#">Preview comments, pinned to elements</a>      </li>      <li class="flex">        <a class="link link-quiet fg-text-strong" href="#">          A dashboard you can drive from the keyboard        </a>      </li>      <li class="flex">        <a class="link link-quiet fg-text-strong" href="#">Why a deployment is immutable</a>      </li>    </ul>  </aside>  <footer class="shell-footer bt(1) bt-solid b-line-hair">    <div class="flex flex-wrap items-center justify-between gap-sm px(20) py-lg text-xs fg-text-muted">      <span>© 2026 Atlas Labs</span>      <nav class="flex flex-wrap gap-lg" aria-label="Footer">        <a class="link link-quiet" href="#">Privacy</a>        <a class="link link-quiet" href="#">Terms</a>        <a class="link link-quiet" href="#">RSS</a>      </nav>    </div>  </footer>  <dialog class="dialog dialog-drawer dialog-drawer-start" id="hg-nav" closedby="any" aria-label="Navigation">    <div class="dialog-body">      <nav class="nav" aria-label="Sections, in the drawer">        <a class="nav-item" href="#">Latest</a>        <a class="nav-item" href="#" aria-current="page">Engineering</a>        <a class="nav-item" href="#">Product</a>        <a class="nav-item" href="#">Company</a>        <a class="nav-item" href="#">Customers</a>      </nav>    </div>    <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="hg-nav" command="close" aria-label="Close navigation">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M4 4L12 12" /><path d="M4 12L12 4" />      </svg>    </button>  </dialog></div>
import MenuIcon from '@master/icons-react/native/16/soft/menu'import ContrastIcon from '@master/icons-react/native/16/soft/contrast'import XIcon from '@master/icons-react/native/16/soft/x'<div className="shell bg-surface-base fg-text-body text-sm" style={{ '--shell-sidebar': '13rem', '--shell-aside': '15rem' } as React.CSSProperties}>  <header className="navbar shell-header bb(1) bb-solid b-line-hair" style={{ '--navbar-padding-x': '1.25rem' } as React.CSSProperties}>    <button type="button" className="btn btn-quiet btn-square btn-sm shell-toggle" {...{ commandfor: 'hg-nav', command: 'show-modal' }} aria-label="Open navigation">      <MenuIcon className="icon" />    </button>    <a className="navbar-brand" href="#"><ContrastIcon className="icon" />Atlas</a>    <div className="navbar-end">      <button type="button" className="btn btn-primary btn-sm">Subscribe</button>    </div>  </header>  <main className="shell-main">    <article className="flex flex-col gap-md max-w(640) mx-auto px(20) py-xl">      <p className="eyebrow">Engineering</p>      <h1 className="heading heading-2xl">How we cut cold builds by forty seconds</h1>      <p className="lead">        Most of a cold build was spent fetching what the last build had already fetched. We stopped throwing it away.      </p>      <p className="m(0) leading-md">        A build starts from an empty machine. For years that was a feature: nothing left over from last time could break this time. It also meant every build downloaded the same two hundred megabytes of dependencies before doing any work of its own.      </p>      <p className="m(0) leading-md">        The fix was not a faster download. It was to key a cache by the lockfile, restore it before the install step, and let the package manager find that it had nothing to do. The install step now takes about three seconds when nothing changed, which is most of the time.      </p>      <p className="m(0) leading-md">        The main column is first in the source, before both side columns. The grid places each region by its class, so the order a screen reader meets them in is the order of importance, not the order on screen.      </p>      <p className="m(0) leading-md">        We measured for a month before turning it on for everyone. Median cold build time went from 96 seconds to 55, and the slowest tenth improved the most, because they had the most to download.      </p>    </article>  </main>  <div className="shell-sidebar p-sm bxe(1) bxe-solid b-line-hair">    <nav className="nav" aria-label="Sections">      <a className="nav-item" href="#">Latest</a>      <a className="nav-item" href="#" aria-current="page">Engineering</a>      <a className="nav-item" href="#">Product</a>      <a className="nav-item" href="#">Company</a>      <a className="nav-item" href="#">Customers</a>    </nav>  </div>  <aside className="shell-aside gap-md px-lg py-xl bxs(1) bxs-solid b-line-hair" aria-labelledby="hg-related">    <h2 className="eyebrow" id="hg-related">More from engineering</h2>    <ul className="flex flex-col gap-md m(0) p(0)">      <li className="flex">        <a className="link link-quiet fg-text-strong" href="#">          Preview comments, pinned to elements        </a>      </li>      <li className="flex">        <a className="link link-quiet fg-text-strong" href="#">          A dashboard you can drive from the keyboard        </a>      </li>      <li className="flex">        <a className="link link-quiet fg-text-strong" href="#">Why a deployment is immutable</a>      </li>    </ul>  </aside>  <footer className="shell-footer bt(1) bt-solid b-line-hair">    <div className="flex flex-wrap items-center justify-between gap-sm px(20) py-lg text-xs fg-text-muted">      <span>© 2026 Atlas Labs</span>      <nav className="flex flex-wrap gap-lg" aria-label="Footer">        <a className="link link-quiet" href="#">Privacy</a>        <a className="link link-quiet" href="#">Terms</a>        <a className="link link-quiet" href="#">RSS</a>      </nav>    </div>  </footer>  <dialog className="dialog dialog-drawer dialog-drawer-start" id="hg-nav" closedby="any" aria-label="Navigation">    <div className="dialog-body">      <nav className="nav" aria-label="Sections, in the drawer">        <a className="nav-item" href="#">Latest</a>        <a className="nav-item" href="#" aria-current="page">Engineering</a>        <a className="nav-item" href="#">Product</a>        <a className="nav-item" href="#">Company</a>        <a className="nav-item" href="#">Customers</a>      </nav>    </div>    <button type="button" className="btn btn-quiet btn-square btn-sm dialog-close" {...{ commandfor: 'hg-nav', command: 'close' }} aria-label="Close navigation">      <XIcon className="icon" />    </button>  </dialog></div>
<script>  import MenuIcon from '@master/icons-svelte/native/16/soft/menu'  import ContrastIcon from '@master/icons-svelte/native/16/soft/contrast'  import XIcon from '@master/icons-svelte/native/16/soft/x'</script><div class="shell bg-surface-base fg-text-body text-sm" style="--shell-sidebar: 13rem; --shell-aside: 15rem">  <header class="navbar shell-header bb(1) bb-solid b-line-hair" style="--navbar-padding-x: 1.25rem">    <button type="button" class="btn btn-quiet btn-square btn-sm shell-toggle" commandfor="hg-nav" command="show-modal" aria-label="Open navigation">      <MenuIcon class="icon" />    </button>    <a class="navbar-brand" href="#"><ContrastIcon class="icon" />Atlas</a>    <div class="navbar-end">      <button type="button" class="btn btn-primary btn-sm">Subscribe</button>    </div>  </header>  <main class="shell-main">    <article class="flex flex-col gap-md max-w(640) mx-auto px(20) py-xl">      <p class="eyebrow">Engineering</p>      <h1 class="heading heading-2xl">How we cut cold builds by forty seconds</h1>      <p class="lead">        Most of a cold build was spent fetching what the last build had already fetched. We stopped throwing it away.      </p>      <p class="m(0) leading-md">        A build starts from an empty machine. For years that was a feature: nothing left over from last time could break this time. It also meant every build downloaded the same two hundred megabytes of dependencies before doing any work of its own.      </p>      <p class="m(0) leading-md">        The fix was not a faster download. It was to key a cache by the lockfile, restore it before the install step, and let the package manager find that it had nothing to do. The install step now takes about three seconds when nothing changed, which is most of the time.      </p>      <p class="m(0) leading-md">        The main column is first in the source, before both side columns. The grid places each region by its class, so the order a screen reader meets them in is the order of importance, not the order on screen.      </p>      <p class="m(0) leading-md">        We measured for a month before turning it on for everyone. Median cold build time went from 96 seconds to 55, and the slowest tenth improved the most, because they had the most to download.      </p>    </article>  </main>  <div class="shell-sidebar p-sm bxe(1) bxe-solid b-line-hair">    <nav class="nav" aria-label="Sections">      <a class="nav-item" href="#">Latest</a>      <a class="nav-item" href="#" aria-current="page">Engineering</a>      <a class="nav-item" href="#">Product</a>      <a class="nav-item" href="#">Company</a>      <a class="nav-item" href="#">Customers</a>    </nav>  </div>  <aside class="shell-aside gap-md px-lg py-xl bxs(1) bxs-solid b-line-hair" aria-labelledby="hg-related">    <h2 class="eyebrow" id="hg-related">More from engineering</h2>    <ul class="flex flex-col gap-md m(0) p(0)">      <li class="flex">        <a class="link link-quiet fg-text-strong" href="#">Preview comments, pinned to elements</a>      </li>      <li class="flex">        <a class="link link-quiet fg-text-strong" href="#">          A dashboard you can drive from the keyboard        </a>      </li>      <li class="flex">        <a class="link link-quiet fg-text-strong" href="#">Why a deployment is immutable</a>      </li>    </ul>  </aside>  <footer class="shell-footer bt(1) bt-solid b-line-hair">    <div class="flex flex-wrap items-center justify-between gap-sm px(20) py-lg text-xs fg-text-muted">      <span>© 2026 Atlas Labs</span>      <nav class="flex flex-wrap gap-lg" aria-label="Footer">        <a class="link link-quiet" href="#">Privacy</a>        <a class="link link-quiet" href="#">Terms</a>        <a class="link link-quiet" href="#">RSS</a>      </nav>    </div>  </footer>  <dialog class="dialog dialog-drawer dialog-drawer-start" id="hg-nav" closedby="any" aria-label="Navigation">    <div class="dialog-body">      <nav class="nav" aria-label="Sections, in the drawer">        <a class="nav-item" href="#">Latest</a>        <a class="nav-item" href="#" aria-current="page">Engineering</a>        <a class="nav-item" href="#">Product</a>        <a class="nav-item" href="#">Company</a>        <a class="nav-item" href="#">Customers</a>      </nav>    </div>    <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="hg-nav" command="close" aria-label="Close navigation">      <XIcon class="icon" />    </button>  </dialog></div>
<script setup>import MenuIcon from '@master/icons-vue/native/16/soft/menu'import ContrastIcon from '@master/icons-vue/native/16/soft/contrast'import XIcon from '@master/icons-vue/native/16/soft/x'</script><template>  <div class="shell bg-surface-base fg-text-body text-sm" style="--shell-sidebar: 13rem; --shell-aside: 15rem">    <header class="navbar shell-header bb(1) bb-solid b-line-hair" style="--navbar-padding-x: 1.25rem">      <button type="button" class="btn btn-quiet btn-square btn-sm shell-toggle" commandfor="hg-nav" command="show-modal" aria-label="Open navigation">        <MenuIcon class="icon" />      </button>      <a class="navbar-brand" href="#"><ContrastIcon class="icon" />Atlas</a>      <div class="navbar-end">        <button type="button" class="btn btn-primary btn-sm">Subscribe</button>      </div>    </header>    <main class="shell-main">      <article class="flex flex-col gap-md max-w(640) mx-auto px(20) py-xl">        <p class="eyebrow">Engineering</p>        <h1 class="heading heading-2xl">How we cut cold builds by forty seconds</h1>        <p class="lead">          Most of a cold build was spent fetching what the last build had already fetched. We stopped throwing it away.        </p>        <p class="m(0) leading-md">          A build starts from an empty machine. For years that was a feature: nothing left over from last time could break this time. It also meant every build downloaded the same two hundred megabytes of dependencies before doing any work of its own.        </p>        <p class="m(0) leading-md">          The fix was not a faster download. It was to key a cache by the lockfile, restore it before the install step, and let the package manager find that it had nothing to do. The install step now takes about three seconds when nothing changed, which is most of the time.        </p>        <p class="m(0) leading-md">          The main column is first in the source, before both side columns. The grid places each region by its class, so the order a screen reader meets them in is the order of importance, not the order on screen.        </p>        <p class="m(0) leading-md">          We measured for a month before turning it on for everyone. Median cold build time went from 96 seconds to 55, and the slowest tenth improved the most, because they had the most to download.        </p>      </article>    </main>    <div class="shell-sidebar p-sm bxe(1) bxe-solid b-line-hair">      <nav class="nav" aria-label="Sections">        <a class="nav-item" href="#">Latest</a>        <a class="nav-item" href="#" aria-current="page">Engineering</a>        <a class="nav-item" href="#">Product</a>        <a class="nav-item" href="#">Company</a>        <a class="nav-item" href="#">Customers</a>      </nav>    </div>    <aside class="shell-aside gap-md px-lg py-xl bxs(1) bxs-solid b-line-hair" aria-labelledby="hg-related">      <h2 class="eyebrow" id="hg-related">More from engineering</h2>      <ul class="flex flex-col gap-md m(0) p(0)">        <li class="flex">          <a class="link link-quiet fg-text-strong" href="#">            Preview comments, pinned to elements          </a>        </li>        <li class="flex">          <a class="link link-quiet fg-text-strong" href="#">            A dashboard you can drive from the keyboard          </a>        </li>        <li class="flex">          <a class="link link-quiet fg-text-strong" href="#">Why a deployment is immutable</a>        </li>      </ul>    </aside>    <footer class="shell-footer bt(1) bt-solid b-line-hair">      <div class="flex flex-wrap items-center justify-between gap-sm px(20) py-lg text-xs fg-text-muted">        <span>© 2026 Atlas Labs</span>        <nav class="flex flex-wrap gap-lg" aria-label="Footer">          <a class="link link-quiet" href="#">Privacy</a>          <a class="link link-quiet" href="#">Terms</a>          <a class="link link-quiet" href="#">RSS</a>        </nav>      </div>    </footer>    <dialog class="dialog dialog-drawer dialog-drawer-start" id="hg-nav" closedby="any" aria-label="Navigation">      <div class="dialog-body">        <nav class="nav" aria-label="Sections, in the drawer">          <a class="nav-item" href="#">Latest</a>          <a class="nav-item" href="#" aria-current="page">Engineering</a>          <a class="nav-item" href="#">Product</a>          <a class="nav-item" href="#">Company</a>          <a class="nav-item" href="#">Customers</a>        </nav>      </div>      <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="hg-nav" command="close" aria-label="Close navigation">        <XIcon class="icon" />      </button>    </dialog>  </div></template>
捲過三欄後就會看到頁尾。切換到「平板」時,結尾側欄會隱藏。切換到「手機」時,起始側欄會移入抽屜。

#建構方式

  • shell-header 和 shell-footer 橫跨整個外框,shell-sidebar、shell-main 和 shell-aside 共用中間那一列。
  • 原始碼順序可自行安排。 每個區域在版面上的位置由類別決定,與標記中的位置無關。此處的 <main> 緊接在頁首後,排在兩側欄位之前,因此螢幕閱讀器、搜尋引擎和 Tab 鍵巡覽都會先到主要區域。
  • 兩側欄位固定寬度,中間欄隨空間伸縮。 用 --shell-sidebar 和 --shell-aside 設定寬度,主要區域會占用剩餘空間,寬度不會超出這個範圍。
  • 三欄所在的列至少與檢視區等高,所以兩側欄位在閱讀期間可以留在畫面上,頁尾則從初始可見範圍下方開始。
  • 整個外框共用同一條邊線。 頁首將 --navbar-padding-x 設為 1.25rem,也就是側邊欄內距加上導覽項目的內距;頁尾使用 px(20),因此品牌、章節和頁尾文字都從同一條線開始。
  • 用 utility 畫細分隔線。 bxe(1) bxe-solid b-line-hair 在起始側欄的結尾側畫線,bxs(…) 則在結尾側欄的起始側畫線。兩者都會依書寫方向定位。

#使用時機

同一份內容若需要兩個用途不同的側欄,一個指引其他去處,一個補充相關內容,就使用三欄。如果其中一欄只放本頁目錄,用文件版面即可更簡潔地達成同樣目的。不需要第二個側欄時,這就是應用程式框架。

#無障礙

  • 起始側欄是包住帶有「章節」標籤 <nav> 的一般元素,因此只算一個地標,而不是兩個。結尾側欄沒有導覽,它是以標題命名的 <aside>,其中的連結組成一份清單。
  • 主要區域在原始碼中排在側欄之前,因此 Tab 鍵會依序移到頁首、主要區域和兩側欄位。確認這個順序符合讀者的預期。如果不符合,請將 <main> 移到導覽之後。