網站頁首放置品牌、主要連結,以及最希望訪客採取的行動。這個區塊以導覽列為基礎,加入實際網站會用到的功能。其中一個導覽項目下方有可展開的選單,空間不足時會隱藏次要操作,手機上則改用抽屜選單。這些功能都不需要腳本。
頁首
<a class="skip" href="#header-main">Skip to content</a><header class="navbar" style="--navbar-padding-x: 1.5rem"> <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> <nav class="navbar-nav" aria-label="Main"> <button type="button" class="navbar-link" popovertarget="header-product"> Product<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="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" /> </svg> </button> <div class="popover p(4)" id="header-product" popover> <ul class="list list-interactive w(320)"> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M10 1.6667C5 5.8333 4.5833 10.8333 7.0833 15.4167H12.9167C15.4167 10.8333 15 5.8333 10 1.6667Z" /><circle cx="10" cy="8.3333" r="1" fill="currentColor" stroke="none" /><path d="M12.5059 15.4167Q12.6134 15.5471 12.7721 15.6266L15.7283 17.1047A0.8249 0.8249 0 0 0 16.9109 16.5023L17.6842 11.8631A0.8257 0.8257 0 0 0 17.4914 11.1839L14.9083 8.2317A0.8274 0.8274 0 0 0 14.1839 7.9561C14.3744 8.793 14.4431 9.6377 14.3995 10.4832L14.5438 9.7135L16.4181 11.8557L15.7727 15.7292L13.6179 14.6519L13.9005 13.1446C13.6551 13.9094 13.3247 14.6686 12.9167 15.4167H12.5059ZM5.8161 7.9561A0.8199 0.8199 0 0 0 5.0917 8.2318L2.5086 11.1839A0.8257 0.8257 0 0 0 2.3158 11.8631L3.089 16.5023A0.825 0.825 0 0 0 4.2717 17.1047L7.2279 15.6266Q7.3866 15.5471 7.4941 15.4167H7.0833C6.6753 14.6686 6.3449 13.9094 6.0995 13.1446L6.3821 14.6519L4.2274 15.7292L3.5818 11.8557L5.4562 9.7135L5.6005 10.4832C5.5569 9.6377 5.6256 8.793 5.8161 7.9561Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M8.3333 18.75L11.6667 18.75" /> </svg> </span> <div class="list-body"> <p class="list-title">Deployments</p> <p class="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <circle cx="10" cy="10" r="7.5" /><path d="M10.9634 2.5621A7.504 7.504 0 0 0 9.0366 2.5621Q7.6452 3.9922 6.8517 5.7596Q6.0678 7.5056 5.9561 9.375H2.5261A7.4963 7.4963 0 0 0 2.5261 10.625H5.9561Q6.0678 12.4944 6.8517 14.2404Q7.6452 16.0078 9.0366 17.4378A7.492 7.492 0 0 0 10.9634 17.4378Q12.3547 16.0078 13.1483 14.2404Q13.9322 12.4944 14.0439 10.625H17.4739A7.4963 7.4963 0 0 0 17.4739 9.375H14.0439Q13.9322 7.5056 13.1483 5.7596Q12.3547 3.9922 10.9634 2.5621ZM12.0079 6.2716Q12.6818 7.7726 12.7913 9.375H7.2087Q7.3182 7.7726 7.9921 6.2716Q8.7137 4.6643 10 3.3652Q11.2863 4.6643 12.0079 6.2716ZM7.9921 13.7284Q7.3182 12.2274 7.2087 10.625H12.7913Q12.6818 12.2274 12.0079 13.7284Q11.2863 15.3357 10 16.6348Q8.7137 15.3357 7.9921 13.7284Z" fill="currentColor" stroke="none" fill-rule="evenodd" /> </svg> </span> <div class="list-body"> <p class="list-title">Domains</p> <p class="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <rect x="3" y="10" width="3" height="7.5" rx="0.75" /><rect x="8.5" y="4" width="3" height="13.5" rx="0.75" /><rect x="14" y="7.5" width="3" height="10" rx="0.75" /> </svg> </span> <div class="list-body"> <p class="list-title">Analytics</p> <p class="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M9.6667 2.6667Q10 2.5 10.3333 2.6667C12.0833 4 14.5833 4.75 16.3333 5Q16.6667 5 16.6667 5.3333V9.1667C16.6667 13.3333 14.1667 16.25 10.3333 17.4Q10 17.5 9.6667 17.4C5.8333 16.25 3.3333 13.3333 3.3333 9.1667V5.3333Q3.3333 5 3.6667 5C5.4167 4.75 7.9167 4 9.6667 2.6667Z" /> </svg> </span> <div class="list-body"> <p class="list-title">Firewall</p> <p class="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a class="navbar-link" href="#">Pricing</a> <a class="navbar-link" href="#">Docs</a> <a class="navbar-link" href="#">Changelog</a> </nav> <div class="navbar-end"> <a class="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a class="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" class="btn btn-quiet btn-square btn-sm navbar-toggle" commandfor="header-menu" command="show-modal" aria-label="Open the menu"> <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> </div> <dialog class="dialog dialog-drawer" id="header-menu" closedby="any" aria-label="Menu" style="--dialog-width: 20rem"> <div class="dialog-body flex flex-col gap-md"> <nav class="nav" aria-label="Main, in the menu"> <div class="nav-label">Product</div> <a class="nav-item" 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"> <path d="M8 1.3333C4 4.6667 3.6667 8.6667 5.6667 12.3333H10.3333C12.3333 8.6667 12 4.6667 8 1.3333Z" /><circle cx="8" cy="6.6667" r="0.85" fill="currentColor" stroke="none" /><path d="M10.016 12.3333Q10.1079 12.4463 10.2446 12.5147L12.5342 13.6594A0.6999 0.6999 0 0 0 13.5377 13.1484L14.1443 9.5091Q14.1989 9.1824 13.9807 8.9328L11.9808 6.6473A0.7011 0.7011 0 0 0 11.3582 6.4146C11.5022 7.0678 11.5536 7.7269 11.5195 8.3865L11.635 7.7707L13.1346 9.4845L12.6181 12.5833L10.8942 11.7215L11.1203 10.5157C10.924 11.1275 10.6597 11.7349 10.3333 12.3333H10.016ZM4.6418 6.4146A0.6958 0.6958 0 0 0 4.0192 6.6473L2.0193 8.9328Q1.8012 9.1824 1.8557 9.5091L2.4623 13.1484A0.6999 0.6999 0 0 0 3.4658 13.6594L5.7554 12.5147Q5.8921 12.4463 5.984 12.3333H5.6667C5.3403 11.7349 5.076 11.1275 4.8797 10.5157L5.1058 11.7215L3.3819 12.5833L2.8654 9.4845L4.365 7.7707L4.4805 8.3865C4.4464 7.7269 4.4978 7.0678 4.6418 6.4146Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M6.6667 15L9.3333 15" /> </svg>Deployments </a> <a class="nav-item" 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.7707 2.0497A6.0005 6.0005 0 0 0 7.2293 2.0497Q6.1162 3.1938 5.4813 4.6077Q4.8542 6.0044 4.7648 7.5H2.0209A5.9913 5.9913 0 0 0 2.0209 8.5H4.7648Q4.8542 9.9956 5.4813 11.3923Q6.1162 12.8062 7.2293 13.9503A6.0005 6.0005 0 0 0 8.7707 13.9503Q9.8838 12.8062 10.5187 11.3923Q11.1458 9.9956 11.2352 8.5H13.9791A5.9913 5.9913 0 0 0 13.9791 7.5H11.2352Q11.1458 6.0044 10.5187 4.6077Q9.8838 3.1938 8.7707 2.0497ZM9.6064 5.0173Q10.1455 6.2181 10.2331 7.5H5.7669Q5.8545 6.2181 6.3936 5.0173Q6.971 3.7314 8 2.6921Q9.029 3.7314 9.6064 5.0173ZM6.3936 10.9827Q5.8545 9.7819 5.7669 8.5H10.2331Q10.1455 9.7819 9.6064 10.9827Q9.029 12.2686 8 13.3079Q6.971 12.2686 6.3936 10.9827Z" fill="currentColor" stroke="none" fill-rule="evenodd" /> </svg>Domains </a> <a class="nav-item" 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"> <rect x="2" y="8" width="2.5" height="6" rx="0.75" /><rect x="6.75" y="3" width="2.5" height="11" rx="0.75" /><rect x="11.5" y="6" width="2.5" height="8" rx="0.75" /> </svg>Analytics </a> <a class="nav-item" 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"> <path d="M7.7333 2.1333Q8 2 8.2667 2.1333C9.6667 3.2 11.6667 3.8 13.0667 4Q13.3333 4 13.3333 4.2667V7.3333C13.3333 10.6667 11.3333 13 8.2667 13.92Q8 14 7.7333 13.92C4.6667 13 2.6667 10.6667 2.6667 7.3333V4.2667Q2.6667 4 2.9333 4C4.3333 3.8 6.3333 3.2 7.7333 2.1333Z" /> </svg>Firewall </a> <div class="nav-label">Resources</div> <a class="nav-item" href="#">Pricing</a> <a class="nav-item" href="#">Docs</a> <a class="nav-item" href="#">Changelog</a> </nav> </div> <footer class="dialog-footer"> <a class="btn" href="#">Sign in</a> <a class="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="header-menu" command="close" aria-label="Close the menu"> <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></header><main class="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main" tabindex="-1"> <h1 class="heading heading-2xl">The page under the header</h1> <p class="lead"> Scroll, and the bar takes its material. Open Product for the menu; choose Phone for the drawer. </p> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div></main>import ContrastIcon from '@master/icons-react/native/16/soft/contrast'import ChevronDownIcon from '@master/icons-react/native/16/soft/chevron-down'import RocketIcon20 from '@master/icons-react/native/20/soft/rocket'import GlobeIcon20 from '@master/icons-react/native/20/soft/globe'import ChartBarIcon20 from '@master/icons-react/native/20/soft/chart-bar'import ShieldIcon20 from '@master/icons-react/native/20/soft/shield'import MenuIcon from '@master/icons-react/native/16/soft/menu'import RocketIcon16 from '@master/icons-react/native/16/soft/rocket'import GlobeIcon16 from '@master/icons-react/native/16/soft/globe'import ChartBarIcon16 from '@master/icons-react/native/16/soft/chart-bar'import ShieldIcon16 from '@master/icons-react/native/16/soft/shield'import XIcon from '@master/icons-react/native/16/soft/x'<> <a className="skip" href="#header-main">Skip to content</a> <header className="navbar" style={{ '--navbar-padding-x': '1.5rem' } as React.CSSProperties}> <a className="navbar-brand" href="#"><ContrastIcon className="icon" />Atlas</a> <nav className="navbar-nav" aria-label="Main"> <button type="button" className="navbar-link" popoverTarget="header-product"> Product<ChevronDownIcon className="icon" /> </button> <div className="popover p(4)" id="header-product" popover=""> <ul className="list list-interactive w(320)"> <li> <a className="list-row" href="#"> <span className="list-media"><RocketIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Deployments</p> <p className="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a className="list-row" href="#"> <span className="list-media"><GlobeIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Domains</p> <p className="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a className="list-row" href="#"> <span className="list-media"><ChartBarIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Analytics</p> <p className="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a className="list-row" href="#"> <span className="list-media"><ShieldIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Firewall</p> <p className="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a className="navbar-link" href="#">Pricing</a> <a className="navbar-link" href="#">Docs</a> <a className="navbar-link" href="#">Changelog</a> </nav> <div className="navbar-end"> <a className="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a className="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" className="btn btn-quiet btn-square btn-sm navbar-toggle" {...{ commandfor: 'header-menu', command: 'show-modal' }} aria-label="Open the menu"> <MenuIcon className="icon" /> </button> </div> <dialog className="dialog dialog-drawer" id="header-menu" closedby="any" aria-label="Menu" style={{ '--dialog-width': '20rem' } as React.CSSProperties}> <div className="dialog-body flex flex-col gap-md"> <nav className="nav" aria-label="Main, in the menu"> <div className="nav-label">Product</div> <a className="nav-item" href="#"><RocketIcon16 className="icon" />Deployments</a> <a className="nav-item" href="#"><GlobeIcon16 className="icon" />Domains</a> <a className="nav-item" href="#"><ChartBarIcon16 className="icon" />Analytics</a> <a className="nav-item" href="#"><ShieldIcon16 className="icon" />Firewall</a> <div className="nav-label">Resources</div> <a className="nav-item" href="#">Pricing</a> <a className="nav-item" href="#">Docs</a> <a className="nav-item" href="#">Changelog</a> </nav> </div> <footer className="dialog-footer"> <a className="btn" href="#">Sign in</a> <a className="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" className="btn btn-quiet btn-square btn-sm dialog-close" {...{ commandfor: 'header-menu', command: 'close' }} aria-label="Close the menu"> <XIcon className="icon" /> </button> </dialog> </header> <main className="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main" tabIndex={-1}> <h1 className="heading heading-2xl">The page under the header</h1> <p className="lead"> Scroll, and the bar takes its material. Open Product for the menu; choose Phone for the drawer. </p> <div className="sheet p-xl h(240)"></div> <div className="sheet p-xl h(240)"></div> <div className="sheet p-xl h(240)"></div> </main></><script> import ContrastIcon from '@master/icons-svelte/native/16/soft/contrast' import ChevronDownIcon from '@master/icons-svelte/native/16/soft/chevron-down' import RocketIcon20 from '@master/icons-svelte/native/20/soft/rocket' import GlobeIcon20 from '@master/icons-svelte/native/20/soft/globe' import ChartBarIcon20 from '@master/icons-svelte/native/20/soft/chart-bar' import ShieldIcon20 from '@master/icons-svelte/native/20/soft/shield' import MenuIcon from '@master/icons-svelte/native/16/soft/menu' import RocketIcon16 from '@master/icons-svelte/native/16/soft/rocket' import GlobeIcon16 from '@master/icons-svelte/native/16/soft/globe' import ChartBarIcon16 from '@master/icons-svelte/native/16/soft/chart-bar' import ShieldIcon16 from '@master/icons-svelte/native/16/soft/shield' import XIcon from '@master/icons-svelte/native/16/soft/x'</script><a class="skip" href="#header-main">Skip to content</a><header class="navbar" style="--navbar-padding-x: 1.5rem"> <a class="navbar-brand" href="#"><ContrastIcon class="icon" />Atlas</a> <nav class="navbar-nav" aria-label="Main"> <button type="button" class="navbar-link" popovertarget="header-product"> Product<ChevronDownIcon class="icon" /> </button> <div class="popover p(4)" id="header-product" popover> <ul class="list list-interactive w(320)"> <li> <a class="list-row" href="#"> <span class="list-media"><RocketIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Deployments</p> <p class="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><GlobeIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Domains</p> <p class="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ChartBarIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Analytics</p> <p class="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ShieldIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Firewall</p> <p class="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a class="navbar-link" href="#">Pricing</a> <a class="navbar-link" href="#">Docs</a> <a class="navbar-link" href="#">Changelog</a> </nav> <div class="navbar-end"> <a class="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a class="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" class="btn btn-quiet btn-square btn-sm navbar-toggle" commandfor="header-menu" command="show-modal" aria-label="Open the menu"> <MenuIcon class="icon" /> </button> </div> <dialog class="dialog dialog-drawer" id="header-menu" closedby="any" aria-label="Menu" style="--dialog-width: 20rem"> <div class="dialog-body flex flex-col gap-md"> <nav class="nav" aria-label="Main, in the menu"> <div class="nav-label">Product</div> <a class="nav-item" href="#"><RocketIcon16 class="icon" />Deployments</a> <a class="nav-item" href="#"><GlobeIcon16 class="icon" />Domains</a> <a class="nav-item" href="#"><ChartBarIcon16 class="icon" />Analytics</a> <a class="nav-item" href="#"><ShieldIcon16 class="icon" />Firewall</a> <div class="nav-label">Resources</div> <a class="nav-item" href="#">Pricing</a> <a class="nav-item" href="#">Docs</a> <a class="nav-item" href="#">Changelog</a> </nav> </div> <footer class="dialog-footer"> <a class="btn" href="#">Sign in</a> <a class="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="header-menu" command="close" aria-label="Close the menu"> <XIcon class="icon" /> </button> </dialog></header><main class="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main" tabindex="-1"> <h1 class="heading heading-2xl">The page under the header</h1> <p class="lead"> Scroll, and the bar takes its material. Open Product for the menu; choose Phone for the drawer. </p> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div></main><script setup>import ContrastIcon from '@master/icons-vue/native/16/soft/contrast'import ChevronDownIcon from '@master/icons-vue/native/16/soft/chevron-down'import RocketIcon20 from '@master/icons-vue/native/20/soft/rocket'import GlobeIcon20 from '@master/icons-vue/native/20/soft/globe'import ChartBarIcon20 from '@master/icons-vue/native/20/soft/chart-bar'import ShieldIcon20 from '@master/icons-vue/native/20/soft/shield'import MenuIcon from '@master/icons-vue/native/16/soft/menu'import RocketIcon16 from '@master/icons-vue/native/16/soft/rocket'import GlobeIcon16 from '@master/icons-vue/native/16/soft/globe'import ChartBarIcon16 from '@master/icons-vue/native/16/soft/chart-bar'import ShieldIcon16 from '@master/icons-vue/native/16/soft/shield'import XIcon from '@master/icons-vue/native/16/soft/x'</script><template> <a class="skip" href="#header-main">Skip to content</a> <header class="navbar" style="--navbar-padding-x: 1.5rem"> <a class="navbar-brand" href="#"><ContrastIcon class="icon" />Atlas</a> <nav class="navbar-nav" aria-label="Main"> <button type="button" class="navbar-link" popovertarget="header-product"> Product<ChevronDownIcon class="icon" /> </button> <div class="popover p(4)" id="header-product" popover> <ul class="list list-interactive w(320)"> <li> <a class="list-row" href="#"> <span class="list-media"><RocketIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Deployments</p> <p class="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><GlobeIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Domains</p> <p class="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ChartBarIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Analytics</p> <p class="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ShieldIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Firewall</p> <p class="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a class="navbar-link" href="#">Pricing</a> <a class="navbar-link" href="#">Docs</a> <a class="navbar-link" href="#">Changelog</a> </nav> <div class="navbar-end"> <a class="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a class="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" class="btn btn-quiet btn-square btn-sm navbar-toggle" commandfor="header-menu" command="show-modal" aria-label="Open the menu"> <MenuIcon class="icon" /> </button> </div> <dialog class="dialog dialog-drawer" id="header-menu" closedby="any" aria-label="Menu" style="--dialog-width: 20rem"> <div class="dialog-body flex flex-col gap-md"> <nav class="nav" aria-label="Main, in the menu"> <div class="nav-label">Product</div> <a class="nav-item" href="#"><RocketIcon16 class="icon" />Deployments</a> <a class="nav-item" href="#"><GlobeIcon16 class="icon" />Domains</a> <a class="nav-item" href="#"><ChartBarIcon16 class="icon" />Analytics</a> <a class="nav-item" href="#"><ShieldIcon16 class="icon" />Firewall</a> <div class="nav-label">Resources</div> <a class="nav-item" href="#">Pricing</a> <a class="nav-item" href="#">Docs</a> <a class="nav-item" href="#">Changelog</a> </nav> </div> <footer class="dialog-footer"> <a class="btn" href="#">Sign in</a> <a class="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="header-menu" command="close" aria-label="Close the menu"> <XIcon class="icon" /> </button> </dialog> </header> <main class="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main" tabindex="-1"> <h1 class="heading heading-2xl">The page under the header</h1> <p class="lead"> Scroll, and the bar takes its material. Open Product for the menu; choose Phone for the drawer. </p> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> </main></template>捲動頁面,開啟「產品」,接著切換至「手機」並開啟選單。
區塊提供可直接複製的標記,沿用頁面的文字顏色和大小。預覽在 body 上設定 fg-text-body text-sm。每個區塊都是尺寸查詢容器,因此會依自身寬度調整版面配置。
#組成
- 以導覽列作為主體。 導覽列會黏附在頂端。有內容捲到導覽列下方時,才會套用霧面玻璃材質。
- 開啟選單的導覽項目使用按鈕。 連結和其中一個
<button popovertarget>都使用navbar-link。「產品」會開啟選單,其餘項目會前往對應頁面。 - 產品選單使用彈出面板,其中放置清單。 面板以按鈕為錨點,在檢視區邊緣會翻轉方向。每一列都是連結,包含標題和一句說明。
- 兩個操作,空間不足時隱藏其中一個。 兩個連結都套用按鈕樣式。「登入」使用
hidden inline-flex@container(--xl),導覽列寬度達 36rem 才會顯示。「開始部署」是唯一使用btn-primary的操作,且一律顯示。 - 只有隱藏導覽連結時才顯示切換按鈕。
navbar-toggle在導覽列寬度低於 36rem 時顯示,這個門檻由導覽列本身設定。 - 抽屜是內含導覽元件的對話框。 使用
commandfor開啟,按關閉按鈕、點擊外部或按下 Esc 都可關閉。抽屜包含與導覽列相同的連結,並在頁尾區放置兩個操作按鈕。
這裡由導覽列擔任尺寸查詢容器,因此其中的 @container(…) utility 以導覽列本身的尺寸為準。
#搭配公告
將橫幅放在頁首上方。橫幅會隨頁面捲出畫面,導覽列則黏附在頂端。若要讓訪客可以關閉橫幅,使用 <dialog open> 並加上 banner-dismissible。
搭配公告
<a class="skip" href="#header-main-b">Skip to content</a><div class="banner banner-inverse" role="region" aria-label="Announcement"> <p class="banner-content"> <span class="banner-title">Atlas 4 is here.</span> Faster builds and a new dashboard. <a class="banner-action" href="#">Read the notes</a> </p></div><header class="navbar" style="--navbar-padding-x: 1.5rem"> <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> <nav class="navbar-nav" aria-label="Main"> <button type="button" class="navbar-link" popovertarget="header-product-b"> Product<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="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" /> </svg> </button> <div class="popover p(4)" id="header-product-b" popover> <ul class="list list-interactive w(320)"> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M10 1.6667C5 5.8333 4.5833 10.8333 7.0833 15.4167H12.9167C15.4167 10.8333 15 5.8333 10 1.6667Z" /><circle cx="10" cy="8.3333" r="1" fill="currentColor" stroke="none" /><path d="M12.5059 15.4167Q12.6134 15.5471 12.7721 15.6266L15.7283 17.1047A0.8249 0.8249 0 0 0 16.9109 16.5023L17.6842 11.8631A0.8257 0.8257 0 0 0 17.4914 11.1839L14.9083 8.2317A0.8274 0.8274 0 0 0 14.1839 7.9561C14.3744 8.793 14.4431 9.6377 14.3995 10.4832L14.5438 9.7135L16.4181 11.8557L15.7727 15.7292L13.6179 14.6519L13.9005 13.1446C13.6551 13.9094 13.3247 14.6686 12.9167 15.4167H12.5059ZM5.8161 7.9561A0.8199 0.8199 0 0 0 5.0917 8.2318L2.5086 11.1839A0.8257 0.8257 0 0 0 2.3158 11.8631L3.089 16.5023A0.825 0.825 0 0 0 4.2717 17.1047L7.2279 15.6266Q7.3866 15.5471 7.4941 15.4167H7.0833C6.6753 14.6686 6.3449 13.9094 6.0995 13.1446L6.3821 14.6519L4.2274 15.7292L3.5818 11.8557L5.4562 9.7135L5.6005 10.4832C5.5569 9.6377 5.6256 8.793 5.8161 7.9561Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M8.3333 18.75L11.6667 18.75" /> </svg> </span> <div class="list-body"> <p class="list-title">Deployments</p> <p class="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <circle cx="10" cy="10" r="7.5" /><path d="M10.9634 2.5621A7.504 7.504 0 0 0 9.0366 2.5621Q7.6452 3.9922 6.8517 5.7596Q6.0678 7.5056 5.9561 9.375H2.5261A7.4963 7.4963 0 0 0 2.5261 10.625H5.9561Q6.0678 12.4944 6.8517 14.2404Q7.6452 16.0078 9.0366 17.4378A7.492 7.492 0 0 0 10.9634 17.4378Q12.3547 16.0078 13.1483 14.2404Q13.9322 12.4944 14.0439 10.625H17.4739A7.4963 7.4963 0 0 0 17.4739 9.375H14.0439Q13.9322 7.5056 13.1483 5.7596Q12.3547 3.9922 10.9634 2.5621ZM12.0079 6.2716Q12.6818 7.7726 12.7913 9.375H7.2087Q7.3182 7.7726 7.9921 6.2716Q8.7137 4.6643 10 3.3652Q11.2863 4.6643 12.0079 6.2716ZM7.9921 13.7284Q7.3182 12.2274 7.2087 10.625H12.7913Q12.6818 12.2274 12.0079 13.7284Q11.2863 15.3357 10 16.6348Q8.7137 15.3357 7.9921 13.7284Z" fill="currentColor" stroke="none" fill-rule="evenodd" /> </svg> </span> <div class="list-body"> <p class="list-title">Domains</p> <p class="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <rect x="3" y="10" width="3" height="7.5" rx="0.75" /><rect x="8.5" y="4" width="3" height="13.5" rx="0.75" /><rect x="14" y="7.5" width="3" height="10" rx="0.75" /> </svg> </span> <div class="list-body"> <p class="list-title">Analytics</p> <p class="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M9.6667 2.6667Q10 2.5 10.3333 2.6667C12.0833 4 14.5833 4.75 16.3333 5Q16.6667 5 16.6667 5.3333V9.1667C16.6667 13.3333 14.1667 16.25 10.3333 17.4Q10 17.5 9.6667 17.4C5.8333 16.25 3.3333 13.3333 3.3333 9.1667V5.3333Q3.3333 5 3.6667 5C5.4167 4.75 7.9167 4 9.6667 2.6667Z" /> </svg> </span> <div class="list-body"> <p class="list-title">Firewall</p> <p class="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a class="navbar-link" href="#">Pricing</a> <a class="navbar-link" href="#">Docs</a> <a class="navbar-link" href="#">Changelog</a> </nav> <div class="navbar-end"> <a class="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a class="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" class="btn btn-quiet btn-square btn-sm navbar-toggle" commandfor="header-menu-b" command="show-modal" aria-label="Open the menu"> <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> </div> <dialog class="dialog dialog-drawer" id="header-menu-b" closedby="any" aria-label="Menu" style="--dialog-width: 20rem"> <div class="dialog-body flex flex-col gap-md"> <nav class="nav" aria-label="Main, in the menu"> <div class="nav-label">Product</div> <a class="nav-item" 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"> <path d="M8 1.3333C4 4.6667 3.6667 8.6667 5.6667 12.3333H10.3333C12.3333 8.6667 12 4.6667 8 1.3333Z" /><circle cx="8" cy="6.6667" r="0.85" fill="currentColor" stroke="none" /><path d="M10.016 12.3333Q10.1079 12.4463 10.2446 12.5147L12.5342 13.6594A0.6999 0.6999 0 0 0 13.5377 13.1484L14.1443 9.5091Q14.1989 9.1824 13.9807 8.9328L11.9808 6.6473A0.7011 0.7011 0 0 0 11.3582 6.4146C11.5022 7.0678 11.5536 7.7269 11.5195 8.3865L11.635 7.7707L13.1346 9.4845L12.6181 12.5833L10.8942 11.7215L11.1203 10.5157C10.924 11.1275 10.6597 11.7349 10.3333 12.3333H10.016ZM4.6418 6.4146A0.6958 0.6958 0 0 0 4.0192 6.6473L2.0193 8.9328Q1.8012 9.1824 1.8557 9.5091L2.4623 13.1484A0.6999 0.6999 0 0 0 3.4658 13.6594L5.7554 12.5147Q5.8921 12.4463 5.984 12.3333H5.6667C5.3403 11.7349 5.076 11.1275 4.8797 10.5157L5.1058 11.7215L3.3819 12.5833L2.8654 9.4845L4.365 7.7707L4.4805 8.3865C4.4464 7.7269 4.4978 7.0678 4.6418 6.4146Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M6.6667 15L9.3333 15" /> </svg>Deployments </a> <a class="nav-item" 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.7707 2.0497A6.0005 6.0005 0 0 0 7.2293 2.0497Q6.1162 3.1938 5.4813 4.6077Q4.8542 6.0044 4.7648 7.5H2.0209A5.9913 5.9913 0 0 0 2.0209 8.5H4.7648Q4.8542 9.9956 5.4813 11.3923Q6.1162 12.8062 7.2293 13.9503A6.0005 6.0005 0 0 0 8.7707 13.9503Q9.8838 12.8062 10.5187 11.3923Q11.1458 9.9956 11.2352 8.5H13.9791A5.9913 5.9913 0 0 0 13.9791 7.5H11.2352Q11.1458 6.0044 10.5187 4.6077Q9.8838 3.1938 8.7707 2.0497ZM9.6064 5.0173Q10.1455 6.2181 10.2331 7.5H5.7669Q5.8545 6.2181 6.3936 5.0173Q6.971 3.7314 8 2.6921Q9.029 3.7314 9.6064 5.0173ZM6.3936 10.9827Q5.8545 9.7819 5.7669 8.5H10.2331Q10.1455 9.7819 9.6064 10.9827Q9.029 12.2686 8 13.3079Q6.971 12.2686 6.3936 10.9827Z" fill="currentColor" stroke="none" fill-rule="evenodd" /> </svg>Domains </a> <a class="nav-item" 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"> <rect x="2" y="8" width="2.5" height="6" rx="0.75" /><rect x="6.75" y="3" width="2.5" height="11" rx="0.75" /><rect x="11.5" y="6" width="2.5" height="8" rx="0.75" /> </svg>Analytics </a> <a class="nav-item" 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"> <path d="M7.7333 2.1333Q8 2 8.2667 2.1333C9.6667 3.2 11.6667 3.8 13.0667 4Q13.3333 4 13.3333 4.2667V7.3333C13.3333 10.6667 11.3333 13 8.2667 13.92Q8 14 7.7333 13.92C4.6667 13 2.6667 10.6667 2.6667 7.3333V4.2667Q2.6667 4 2.9333 4C4.3333 3.8 6.3333 3.2 7.7333 2.1333Z" /> </svg>Firewall </a> <div class="nav-label">Resources</div> <a class="nav-item" href="#">Pricing</a> <a class="nav-item" href="#">Docs</a> <a class="nav-item" href="#">Changelog</a> </nav> </div> <footer class="dialog-footer"> <a class="btn" href="#">Sign in</a> <a class="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="header-menu-b" command="close" aria-label="Close the menu"> <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></header><main class="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main-b" tabindex="-1"> <h1 class="heading heading-2xl">An announcement over the header</h1> <p class="lead">The banner scrolls away with the page; the bar stays.</p> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div></main>import ContrastIcon from '@master/icons-react/native/16/soft/contrast'import ChevronDownIcon from '@master/icons-react/native/16/soft/chevron-down'import RocketIcon20 from '@master/icons-react/native/20/soft/rocket'import GlobeIcon20 from '@master/icons-react/native/20/soft/globe'import ChartBarIcon20 from '@master/icons-react/native/20/soft/chart-bar'import ShieldIcon20 from '@master/icons-react/native/20/soft/shield'import MenuIcon from '@master/icons-react/native/16/soft/menu'import RocketIcon16 from '@master/icons-react/native/16/soft/rocket'import GlobeIcon16 from '@master/icons-react/native/16/soft/globe'import ChartBarIcon16 from '@master/icons-react/native/16/soft/chart-bar'import ShieldIcon16 from '@master/icons-react/native/16/soft/shield'import XIcon from '@master/icons-react/native/16/soft/x'<> <a className="skip" href="#header-main-b">Skip to content</a> <div className="banner banner-inverse" role="region" aria-label="Announcement"> <p className="banner-content"> <span className="banner-title">Atlas 4 is here.</span> Faster builds and a new dashboard. <a className="banner-action" href="#">Read the notes</a> </p> </div> <header className="navbar" style={{ '--navbar-padding-x': '1.5rem' } as React.CSSProperties}> <a className="navbar-brand" href="#"><ContrastIcon className="icon" />Atlas</a> <nav className="navbar-nav" aria-label="Main"> <button type="button" className="navbar-link" popoverTarget="header-product-b"> Product<ChevronDownIcon className="icon" /> </button> <div className="popover p(4)" id="header-product-b" popover=""> <ul className="list list-interactive w(320)"> <li> <a className="list-row" href="#"> <span className="list-media"><RocketIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Deployments</p> <p className="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a className="list-row" href="#"> <span className="list-media"><GlobeIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Domains</p> <p className="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a className="list-row" href="#"> <span className="list-media"><ChartBarIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Analytics</p> <p className="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a className="list-row" href="#"> <span className="list-media"><ShieldIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Firewall</p> <p className="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a className="navbar-link" href="#">Pricing</a> <a className="navbar-link" href="#">Docs</a> <a className="navbar-link" href="#">Changelog</a> </nav> <div className="navbar-end"> <a className="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a className="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" className="btn btn-quiet btn-square btn-sm navbar-toggle" {...{ commandfor: 'header-menu-b', command: 'show-modal' }} aria-label="Open the menu"> <MenuIcon className="icon" /> </button> </div> <dialog className="dialog dialog-drawer" id="header-menu-b" closedby="any" aria-label="Menu" style={{ '--dialog-width': '20rem' } as React.CSSProperties}> <div className="dialog-body flex flex-col gap-md"> <nav className="nav" aria-label="Main, in the menu"> <div className="nav-label">Product</div> <a className="nav-item" href="#"><RocketIcon16 className="icon" />Deployments</a> <a className="nav-item" href="#"><GlobeIcon16 className="icon" />Domains</a> <a className="nav-item" href="#"><ChartBarIcon16 className="icon" />Analytics</a> <a className="nav-item" href="#"><ShieldIcon16 className="icon" />Firewall</a> <div className="nav-label">Resources</div> <a className="nav-item" href="#">Pricing</a> <a className="nav-item" href="#">Docs</a> <a className="nav-item" href="#">Changelog</a> </nav> </div> <footer className="dialog-footer"> <a className="btn" href="#">Sign in</a> <a className="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" className="btn btn-quiet btn-square btn-sm dialog-close" {...{ commandfor: 'header-menu-b', command: 'close' }} aria-label="Close the menu"> <XIcon className="icon" /> </button> </dialog> </header> <main className="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main-b" tabIndex={-1}> <h1 className="heading heading-2xl">An announcement over the header</h1> <p className="lead">The banner scrolls away with the page; the bar stays.</p> <div className="sheet p-xl h(240)"></div> <div className="sheet p-xl h(240)"></div> <div className="sheet p-xl h(240)"></div> </main></><script> import ContrastIcon from '@master/icons-svelte/native/16/soft/contrast' import ChevronDownIcon from '@master/icons-svelte/native/16/soft/chevron-down' import RocketIcon20 from '@master/icons-svelte/native/20/soft/rocket' import GlobeIcon20 from '@master/icons-svelte/native/20/soft/globe' import ChartBarIcon20 from '@master/icons-svelte/native/20/soft/chart-bar' import ShieldIcon20 from '@master/icons-svelte/native/20/soft/shield' import MenuIcon from '@master/icons-svelte/native/16/soft/menu' import RocketIcon16 from '@master/icons-svelte/native/16/soft/rocket' import GlobeIcon16 from '@master/icons-svelte/native/16/soft/globe' import ChartBarIcon16 from '@master/icons-svelte/native/16/soft/chart-bar' import ShieldIcon16 from '@master/icons-svelte/native/16/soft/shield' import XIcon from '@master/icons-svelte/native/16/soft/x'</script><a class="skip" href="#header-main-b">Skip to content</a><div class="banner banner-inverse" role="region" aria-label="Announcement"> <p class="banner-content"> <span class="banner-title">Atlas 4 is here.</span> Faster builds and a new dashboard. <a class="banner-action" href="#">Read the notes</a> </p></div><header class="navbar" style="--navbar-padding-x: 1.5rem"> <a class="navbar-brand" href="#"><ContrastIcon class="icon" />Atlas</a> <nav class="navbar-nav" aria-label="Main"> <button type="button" class="navbar-link" popovertarget="header-product-b"> Product<ChevronDownIcon class="icon" /> </button> <div class="popover p(4)" id="header-product-b" popover> <ul class="list list-interactive w(320)"> <li> <a class="list-row" href="#"> <span class="list-media"><RocketIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Deployments</p> <p class="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><GlobeIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Domains</p> <p class="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ChartBarIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Analytics</p> <p class="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ShieldIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Firewall</p> <p class="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a class="navbar-link" href="#">Pricing</a> <a class="navbar-link" href="#">Docs</a> <a class="navbar-link" href="#">Changelog</a> </nav> <div class="navbar-end"> <a class="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a class="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" class="btn btn-quiet btn-square btn-sm navbar-toggle" commandfor="header-menu-b" command="show-modal" aria-label="Open the menu"> <MenuIcon class="icon" /> </button> </div> <dialog class="dialog dialog-drawer" id="header-menu-b" closedby="any" aria-label="Menu" style="--dialog-width: 20rem"> <div class="dialog-body flex flex-col gap-md"> <nav class="nav" aria-label="Main, in the menu"> <div class="nav-label">Product</div> <a class="nav-item" href="#"><RocketIcon16 class="icon" />Deployments</a> <a class="nav-item" href="#"><GlobeIcon16 class="icon" />Domains</a> <a class="nav-item" href="#"><ChartBarIcon16 class="icon" />Analytics</a> <a class="nav-item" href="#"><ShieldIcon16 class="icon" />Firewall</a> <div class="nav-label">Resources</div> <a class="nav-item" href="#">Pricing</a> <a class="nav-item" href="#">Docs</a> <a class="nav-item" href="#">Changelog</a> </nav> </div> <footer class="dialog-footer"> <a class="btn" href="#">Sign in</a> <a class="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="header-menu-b" command="close" aria-label="Close the menu"> <XIcon class="icon" /> </button> </dialog></header><main class="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main-b" tabindex="-1"> <h1 class="heading heading-2xl">An announcement over the header</h1> <p class="lead">The banner scrolls away with the page; the bar stays.</p> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div></main><script setup>import ContrastIcon from '@master/icons-vue/native/16/soft/contrast'import ChevronDownIcon from '@master/icons-vue/native/16/soft/chevron-down'import RocketIcon20 from '@master/icons-vue/native/20/soft/rocket'import GlobeIcon20 from '@master/icons-vue/native/20/soft/globe'import ChartBarIcon20 from '@master/icons-vue/native/20/soft/chart-bar'import ShieldIcon20 from '@master/icons-vue/native/20/soft/shield'import MenuIcon from '@master/icons-vue/native/16/soft/menu'import RocketIcon16 from '@master/icons-vue/native/16/soft/rocket'import GlobeIcon16 from '@master/icons-vue/native/16/soft/globe'import ChartBarIcon16 from '@master/icons-vue/native/16/soft/chart-bar'import ShieldIcon16 from '@master/icons-vue/native/16/soft/shield'import XIcon from '@master/icons-vue/native/16/soft/x'</script><template> <a class="skip" href="#header-main-b">Skip to content</a> <div class="banner banner-inverse" role="region" aria-label="Announcement"> <p class="banner-content"> <span class="banner-title">Atlas 4 is here.</span> Faster builds and a new dashboard. <a class="banner-action" href="#">Read the notes</a> </p> </div> <header class="navbar" style="--navbar-padding-x: 1.5rem"> <a class="navbar-brand" href="#"><ContrastIcon class="icon" />Atlas</a> <nav class="navbar-nav" aria-label="Main"> <button type="button" class="navbar-link" popovertarget="header-product-b"> Product<ChevronDownIcon class="icon" /> </button> <div class="popover p(4)" id="header-product-b" popover> <ul class="list list-interactive w(320)"> <li> <a class="list-row" href="#"> <span class="list-media"><RocketIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Deployments</p> <p class="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><GlobeIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Domains</p> <p class="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ChartBarIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Analytics</p> <p class="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ShieldIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Firewall</p> <p class="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a class="navbar-link" href="#">Pricing</a> <a class="navbar-link" href="#">Docs</a> <a class="navbar-link" href="#">Changelog</a> </nav> <div class="navbar-end"> <a class="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a class="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" class="btn btn-quiet btn-square btn-sm navbar-toggle" commandfor="header-menu-b" command="show-modal" aria-label="Open the menu"> <MenuIcon class="icon" /> </button> </div> <dialog class="dialog dialog-drawer" id="header-menu-b" closedby="any" aria-label="Menu" style="--dialog-width: 20rem"> <div class="dialog-body flex flex-col gap-md"> <nav class="nav" aria-label="Main, in the menu"> <div class="nav-label">Product</div> <a class="nav-item" href="#"><RocketIcon16 class="icon" />Deployments</a> <a class="nav-item" href="#"><GlobeIcon16 class="icon" />Domains</a> <a class="nav-item" href="#"><ChartBarIcon16 class="icon" />Analytics</a> <a class="nav-item" href="#"><ShieldIcon16 class="icon" />Firewall</a> <div class="nav-label">Resources</div> <a class="nav-item" href="#">Pricing</a> <a class="nav-item" href="#">Docs</a> <a class="nav-item" href="#">Changelog</a> </nav> </div> <footer class="dialog-footer"> <a class="btn" href="#">Sign in</a> <a class="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="header-menu-b" command="close" aria-label="Close the menu"> <XIcon class="icon" /> </button> </dialog> </header> <main class="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main-b" tabindex="-1"> <h1 class="heading heading-2xl">An announcement over the header</h1> <p class="lead">The banner scrolls away with the page; the bar stays.</p> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> </main></template>#浮動樣式
navbar-floating 讓導覽列從一開始就有外距、表面的圓角和材質。max-w(960) mx-auto 可避免它在寬螢幕上橫跨整個畫面。
浮動樣式
<a class="skip" href="#header-main-f">Skip to content</a><header class="navbar navbar-floating max-w(960) mx-auto"> <a class="navbar-brand ml-xs" 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> <nav class="navbar-nav" aria-label="Main"> <button type="button" class="navbar-link" popovertarget="header-product-f"> Product<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="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" /> </svg> </button> <div class="popover p(4)" id="header-product-f" popover> <ul class="list list-interactive w(320)"> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M10 1.6667C5 5.8333 4.5833 10.8333 7.0833 15.4167H12.9167C15.4167 10.8333 15 5.8333 10 1.6667Z" /><circle cx="10" cy="8.3333" r="1" fill="currentColor" stroke="none" /><path d="M12.5059 15.4167Q12.6134 15.5471 12.7721 15.6266L15.7283 17.1047A0.8249 0.8249 0 0 0 16.9109 16.5023L17.6842 11.8631A0.8257 0.8257 0 0 0 17.4914 11.1839L14.9083 8.2317A0.8274 0.8274 0 0 0 14.1839 7.9561C14.3744 8.793 14.4431 9.6377 14.3995 10.4832L14.5438 9.7135L16.4181 11.8557L15.7727 15.7292L13.6179 14.6519L13.9005 13.1446C13.6551 13.9094 13.3247 14.6686 12.9167 15.4167H12.5059ZM5.8161 7.9561A0.8199 0.8199 0 0 0 5.0917 8.2318L2.5086 11.1839A0.8257 0.8257 0 0 0 2.3158 11.8631L3.089 16.5023A0.825 0.825 0 0 0 4.2717 17.1047L7.2279 15.6266Q7.3866 15.5471 7.4941 15.4167H7.0833C6.6753 14.6686 6.3449 13.9094 6.0995 13.1446L6.3821 14.6519L4.2274 15.7292L3.5818 11.8557L5.4562 9.7135L5.6005 10.4832C5.5569 9.6377 5.6256 8.793 5.8161 7.9561Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M8.3333 18.75L11.6667 18.75" /> </svg> </span> <div class="list-body"> <p class="list-title">Deployments</p> <p class="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <circle cx="10" cy="10" r="7.5" /><path d="M10.9634 2.5621A7.504 7.504 0 0 0 9.0366 2.5621Q7.6452 3.9922 6.8517 5.7596Q6.0678 7.5056 5.9561 9.375H2.5261A7.4963 7.4963 0 0 0 2.5261 10.625H5.9561Q6.0678 12.4944 6.8517 14.2404Q7.6452 16.0078 9.0366 17.4378A7.492 7.492 0 0 0 10.9634 17.4378Q12.3547 16.0078 13.1483 14.2404Q13.9322 12.4944 14.0439 10.625H17.4739A7.4963 7.4963 0 0 0 17.4739 9.375H14.0439Q13.9322 7.5056 13.1483 5.7596Q12.3547 3.9922 10.9634 2.5621ZM12.0079 6.2716Q12.6818 7.7726 12.7913 9.375H7.2087Q7.3182 7.7726 7.9921 6.2716Q8.7137 4.6643 10 3.3652Q11.2863 4.6643 12.0079 6.2716ZM7.9921 13.7284Q7.3182 12.2274 7.2087 10.625H12.7913Q12.6818 12.2274 12.0079 13.7284Q11.2863 15.3357 10 16.6348Q8.7137 15.3357 7.9921 13.7284Z" fill="currentColor" stroke="none" fill-rule="evenodd" /> </svg> </span> <div class="list-body"> <p class="list-title">Domains</p> <p class="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <rect x="3" y="10" width="3" height="7.5" rx="0.75" /><rect x="8.5" y="4" width="3" height="13.5" rx="0.75" /><rect x="14" y="7.5" width="3" height="10" rx="0.75" /> </svg> </span> <div class="list-body"> <p class="list-title">Analytics</p> <p class="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M9.6667 2.6667Q10 2.5 10.3333 2.6667C12.0833 4 14.5833 4.75 16.3333 5Q16.6667 5 16.6667 5.3333V9.1667C16.6667 13.3333 14.1667 16.25 10.3333 17.4Q10 17.5 9.6667 17.4C5.8333 16.25 3.3333 13.3333 3.3333 9.1667V5.3333Q3.3333 5 3.6667 5C5.4167 4.75 7.9167 4 9.6667 2.6667Z" /> </svg> </span> <div class="list-body"> <p class="list-title">Firewall</p> <p class="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a class="navbar-link" href="#">Pricing</a> <a class="navbar-link" href="#">Docs</a> <a class="navbar-link" href="#">Changelog</a> </nav> <div class="navbar-end"> <a class="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a class="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" class="btn btn-quiet btn-square btn-sm navbar-toggle" commandfor="header-menu-f" command="show-modal" aria-label="Open the menu"> <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> </div> <dialog class="dialog dialog-drawer" id="header-menu-f" closedby="any" aria-label="Menu" style="--dialog-width: 20rem"> <div class="dialog-body flex flex-col gap-md"> <nav class="nav" aria-label="Main, in the menu"> <div class="nav-label">Product</div> <a class="nav-item" 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"> <path d="M8 1.3333C4 4.6667 3.6667 8.6667 5.6667 12.3333H10.3333C12.3333 8.6667 12 4.6667 8 1.3333Z" /><circle cx="8" cy="6.6667" r="0.85" fill="currentColor" stroke="none" /><path d="M10.016 12.3333Q10.1079 12.4463 10.2446 12.5147L12.5342 13.6594A0.6999 0.6999 0 0 0 13.5377 13.1484L14.1443 9.5091Q14.1989 9.1824 13.9807 8.9328L11.9808 6.6473A0.7011 0.7011 0 0 0 11.3582 6.4146C11.5022 7.0678 11.5536 7.7269 11.5195 8.3865L11.635 7.7707L13.1346 9.4845L12.6181 12.5833L10.8942 11.7215L11.1203 10.5157C10.924 11.1275 10.6597 11.7349 10.3333 12.3333H10.016ZM4.6418 6.4146A0.6958 0.6958 0 0 0 4.0192 6.6473L2.0193 8.9328Q1.8012 9.1824 1.8557 9.5091L2.4623 13.1484A0.6999 0.6999 0 0 0 3.4658 13.6594L5.7554 12.5147Q5.8921 12.4463 5.984 12.3333H5.6667C5.3403 11.7349 5.076 11.1275 4.8797 10.5157L5.1058 11.7215L3.3819 12.5833L2.8654 9.4845L4.365 7.7707L4.4805 8.3865C4.4464 7.7269 4.4978 7.0678 4.6418 6.4146Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M6.6667 15L9.3333 15" /> </svg>Deployments </a> <a class="nav-item" 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.7707 2.0497A6.0005 6.0005 0 0 0 7.2293 2.0497Q6.1162 3.1938 5.4813 4.6077Q4.8542 6.0044 4.7648 7.5H2.0209A5.9913 5.9913 0 0 0 2.0209 8.5H4.7648Q4.8542 9.9956 5.4813 11.3923Q6.1162 12.8062 7.2293 13.9503A6.0005 6.0005 0 0 0 8.7707 13.9503Q9.8838 12.8062 10.5187 11.3923Q11.1458 9.9956 11.2352 8.5H13.9791A5.9913 5.9913 0 0 0 13.9791 7.5H11.2352Q11.1458 6.0044 10.5187 4.6077Q9.8838 3.1938 8.7707 2.0497ZM9.6064 5.0173Q10.1455 6.2181 10.2331 7.5H5.7669Q5.8545 6.2181 6.3936 5.0173Q6.971 3.7314 8 2.6921Q9.029 3.7314 9.6064 5.0173ZM6.3936 10.9827Q5.8545 9.7819 5.7669 8.5H10.2331Q10.1455 9.7819 9.6064 10.9827Q9.029 12.2686 8 13.3079Q6.971 12.2686 6.3936 10.9827Z" fill="currentColor" stroke="none" fill-rule="evenodd" /> </svg>Domains </a> <a class="nav-item" 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"> <rect x="2" y="8" width="2.5" height="6" rx="0.75" /><rect x="6.75" y="3" width="2.5" height="11" rx="0.75" /><rect x="11.5" y="6" width="2.5" height="8" rx="0.75" /> </svg>Analytics </a> <a class="nav-item" 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"> <path d="M7.7333 2.1333Q8 2 8.2667 2.1333C9.6667 3.2 11.6667 3.8 13.0667 4Q13.3333 4 13.3333 4.2667V7.3333C13.3333 10.6667 11.3333 13 8.2667 13.92Q8 14 7.7333 13.92C4.6667 13 2.6667 10.6667 2.6667 7.3333V4.2667Q2.6667 4 2.9333 4C4.3333 3.8 6.3333 3.2 7.7333 2.1333Z" /> </svg>Firewall </a> <div class="nav-label">Resources</div> <a class="nav-item" href="#">Pricing</a> <a class="nav-item" href="#">Docs</a> <a class="nav-item" href="#">Changelog</a> </nav> </div> <footer class="dialog-footer"> <a class="btn" href="#">Sign in</a> <a class="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="header-menu-f" command="close" aria-label="Close the menu"> <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></header><main class="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main-f" tabindex="-1"> <h1 class="heading heading-2xl">A header that floats</h1> <p class="lead">It keeps a margin from the edges and its material from the start.</p> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div></main>import ContrastIcon from '@master/icons-react/native/16/soft/contrast'import ChevronDownIcon from '@master/icons-react/native/16/soft/chevron-down'import RocketIcon20 from '@master/icons-react/native/20/soft/rocket'import GlobeIcon20 from '@master/icons-react/native/20/soft/globe'import ChartBarIcon20 from '@master/icons-react/native/20/soft/chart-bar'import ShieldIcon20 from '@master/icons-react/native/20/soft/shield'import MenuIcon from '@master/icons-react/native/16/soft/menu'import RocketIcon16 from '@master/icons-react/native/16/soft/rocket'import GlobeIcon16 from '@master/icons-react/native/16/soft/globe'import ChartBarIcon16 from '@master/icons-react/native/16/soft/chart-bar'import ShieldIcon16 from '@master/icons-react/native/16/soft/shield'import XIcon from '@master/icons-react/native/16/soft/x'<> <a className="skip" href="#header-main-f">Skip to content</a> <header className="navbar navbar-floating max-w(960) mx-auto"> <a className="navbar-brand ml-xs" href="#"><ContrastIcon className="icon" />Atlas</a> <nav className="navbar-nav" aria-label="Main"> <button type="button" className="navbar-link" popoverTarget="header-product-f"> Product<ChevronDownIcon className="icon" /> </button> <div className="popover p(4)" id="header-product-f" popover=""> <ul className="list list-interactive w(320)"> <li> <a className="list-row" href="#"> <span className="list-media"><RocketIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Deployments</p> <p className="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a className="list-row" href="#"> <span className="list-media"><GlobeIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Domains</p> <p className="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a className="list-row" href="#"> <span className="list-media"><ChartBarIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Analytics</p> <p className="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a className="list-row" href="#"> <span className="list-media"><ShieldIcon20 className="icon" /></span> <div className="list-body"> <p className="list-title">Firewall</p> <p className="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a className="navbar-link" href="#">Pricing</a> <a className="navbar-link" href="#">Docs</a> <a className="navbar-link" href="#">Changelog</a> </nav> <div className="navbar-end"> <a className="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a className="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" className="btn btn-quiet btn-square btn-sm navbar-toggle" {...{ commandfor: 'header-menu-f', command: 'show-modal' }} aria-label="Open the menu"> <MenuIcon className="icon" /> </button> </div> <dialog className="dialog dialog-drawer" id="header-menu-f" closedby="any" aria-label="Menu" style={{ '--dialog-width': '20rem' } as React.CSSProperties}> <div className="dialog-body flex flex-col gap-md"> <nav className="nav" aria-label="Main, in the menu"> <div className="nav-label">Product</div> <a className="nav-item" href="#"><RocketIcon16 className="icon" />Deployments</a> <a className="nav-item" href="#"><GlobeIcon16 className="icon" />Domains</a> <a className="nav-item" href="#"><ChartBarIcon16 className="icon" />Analytics</a> <a className="nav-item" href="#"><ShieldIcon16 className="icon" />Firewall</a> <div className="nav-label">Resources</div> <a className="nav-item" href="#">Pricing</a> <a className="nav-item" href="#">Docs</a> <a className="nav-item" href="#">Changelog</a> </nav> </div> <footer className="dialog-footer"> <a className="btn" href="#">Sign in</a> <a className="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" className="btn btn-quiet btn-square btn-sm dialog-close" {...{ commandfor: 'header-menu-f', command: 'close' }} aria-label="Close the menu"> <XIcon className="icon" /> </button> </dialog> </header> <main className="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main-f" tabIndex={-1}> <h1 className="heading heading-2xl">A header that floats</h1> <p className="lead">It keeps a margin from the edges and its material from the start.</p> <div className="sheet p-xl h(240)"></div> <div className="sheet p-xl h(240)"></div> <div className="sheet p-xl h(240)"></div> </main></><script> import ContrastIcon from '@master/icons-svelte/native/16/soft/contrast' import ChevronDownIcon from '@master/icons-svelte/native/16/soft/chevron-down' import RocketIcon20 from '@master/icons-svelte/native/20/soft/rocket' import GlobeIcon20 from '@master/icons-svelte/native/20/soft/globe' import ChartBarIcon20 from '@master/icons-svelte/native/20/soft/chart-bar' import ShieldIcon20 from '@master/icons-svelte/native/20/soft/shield' import MenuIcon from '@master/icons-svelte/native/16/soft/menu' import RocketIcon16 from '@master/icons-svelte/native/16/soft/rocket' import GlobeIcon16 from '@master/icons-svelte/native/16/soft/globe' import ChartBarIcon16 from '@master/icons-svelte/native/16/soft/chart-bar' import ShieldIcon16 from '@master/icons-svelte/native/16/soft/shield' import XIcon from '@master/icons-svelte/native/16/soft/x'</script><a class="skip" href="#header-main-f">Skip to content</a><header class="navbar navbar-floating max-w(960) mx-auto"> <a class="navbar-brand ml-xs" href="#"><ContrastIcon class="icon" />Atlas</a> <nav class="navbar-nav" aria-label="Main"> <button type="button" class="navbar-link" popovertarget="header-product-f"> Product<ChevronDownIcon class="icon" /> </button> <div class="popover p(4)" id="header-product-f" popover> <ul class="list list-interactive w(320)"> <li> <a class="list-row" href="#"> <span class="list-media"><RocketIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Deployments</p> <p class="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><GlobeIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Domains</p> <p class="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ChartBarIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Analytics</p> <p class="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ShieldIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Firewall</p> <p class="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a class="navbar-link" href="#">Pricing</a> <a class="navbar-link" href="#">Docs</a> <a class="navbar-link" href="#">Changelog</a> </nav> <div class="navbar-end"> <a class="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a class="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" class="btn btn-quiet btn-square btn-sm navbar-toggle" commandfor="header-menu-f" command="show-modal" aria-label="Open the menu"> <MenuIcon class="icon" /> </button> </div> <dialog class="dialog dialog-drawer" id="header-menu-f" closedby="any" aria-label="Menu" style="--dialog-width: 20rem"> <div class="dialog-body flex flex-col gap-md"> <nav class="nav" aria-label="Main, in the menu"> <div class="nav-label">Product</div> <a class="nav-item" href="#"><RocketIcon16 class="icon" />Deployments</a> <a class="nav-item" href="#"><GlobeIcon16 class="icon" />Domains</a> <a class="nav-item" href="#"><ChartBarIcon16 class="icon" />Analytics</a> <a class="nav-item" href="#"><ShieldIcon16 class="icon" />Firewall</a> <div class="nav-label">Resources</div> <a class="nav-item" href="#">Pricing</a> <a class="nav-item" href="#">Docs</a> <a class="nav-item" href="#">Changelog</a> </nav> </div> <footer class="dialog-footer"> <a class="btn" href="#">Sign in</a> <a class="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="header-menu-f" command="close" aria-label="Close the menu"> <XIcon class="icon" /> </button> </dialog></header><main class="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main-f" tabindex="-1"> <h1 class="heading heading-2xl">A header that floats</h1> <p class="lead">It keeps a margin from the edges and its material from the start.</p> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div></main><script setup>import ContrastIcon from '@master/icons-vue/native/16/soft/contrast'import ChevronDownIcon from '@master/icons-vue/native/16/soft/chevron-down'import RocketIcon20 from '@master/icons-vue/native/20/soft/rocket'import GlobeIcon20 from '@master/icons-vue/native/20/soft/globe'import ChartBarIcon20 from '@master/icons-vue/native/20/soft/chart-bar'import ShieldIcon20 from '@master/icons-vue/native/20/soft/shield'import MenuIcon from '@master/icons-vue/native/16/soft/menu'import RocketIcon16 from '@master/icons-vue/native/16/soft/rocket'import GlobeIcon16 from '@master/icons-vue/native/16/soft/globe'import ChartBarIcon16 from '@master/icons-vue/native/16/soft/chart-bar'import ShieldIcon16 from '@master/icons-vue/native/16/soft/shield'import XIcon from '@master/icons-vue/native/16/soft/x'</script><template> <a class="skip" href="#header-main-f">Skip to content</a> <header class="navbar navbar-floating max-w(960) mx-auto"> <a class="navbar-brand ml-xs" href="#"><ContrastIcon class="icon" />Atlas</a> <nav class="navbar-nav" aria-label="Main"> <button type="button" class="navbar-link" popovertarget="header-product-f"> Product<ChevronDownIcon class="icon" /> </button> <div class="popover p(4)" id="header-product-f" popover> <ul class="list list-interactive w(320)"> <li> <a class="list-row" href="#"> <span class="list-media"><RocketIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Deployments</p> <p class="list-description">Every push gets its own address.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><GlobeIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Domains</p> <p class="list-description">Certificates that renew themselves.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ChartBarIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Analytics</p> <p class="list-description">Traffic and speed, without cookies.</p> </div> </a> </li> <li> <a class="list-row" href="#"> <span class="list-media"><ShieldIcon20 class="icon" /></span> <div class="list-body"> <p class="list-title">Firewall</p> <p class="list-description">Rules at the edge, in every region.</p> </div> </a> </li> </ul> </div> <a class="navbar-link" href="#">Pricing</a> <a class="navbar-link" href="#">Docs</a> <a class="navbar-link" href="#">Changelog</a> </nav> <div class="navbar-end"> <a class="btn btn-quiet btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a> <a class="btn btn-primary btn-sm" href="#">Start deploying</a> <button type="button" class="btn btn-quiet btn-square btn-sm navbar-toggle" commandfor="header-menu-f" command="show-modal" aria-label="Open the menu"> <MenuIcon class="icon" /> </button> </div> <dialog class="dialog dialog-drawer" id="header-menu-f" closedby="any" aria-label="Menu" style="--dialog-width: 20rem"> <div class="dialog-body flex flex-col gap-md"> <nav class="nav" aria-label="Main, in the menu"> <div class="nav-label">Product</div> <a class="nav-item" href="#"><RocketIcon16 class="icon" />Deployments</a> <a class="nav-item" href="#"><GlobeIcon16 class="icon" />Domains</a> <a class="nav-item" href="#"><ChartBarIcon16 class="icon" />Analytics</a> <a class="nav-item" href="#"><ShieldIcon16 class="icon" />Firewall</a> <div class="nav-label">Resources</div> <a class="nav-item" href="#">Pricing</a> <a class="nav-item" href="#">Docs</a> <a class="nav-item" href="#">Changelog</a> </nav> </div> <footer class="dialog-footer"> <a class="btn" href="#">Sign in</a> <a class="btn btn-primary" href="#">Start deploying</a> </footer> <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="header-menu-f" command="close" aria-label="Close the menu"> <XIcon class="icon" /> </button> </dialog> </header> <main class="max-w(720) mx-auto px-lg py-3xl flex flex-col gap-md" id="header-main-f" tabindex="-1"> <h1 class="heading heading-2xl">A header that floats</h1> <p class="lead">It keeps a margin from the edges and its material from the start.</p> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> <div class="sheet p-xl h(240)"></div> </main></template>#無障礙
- 頁面的第一個元素是指向
<main>的跳至主要內容連結,讓使用者跳過頁首。在主要內容上設定tabindex="-1",讓焦點隨跳轉一起移動。 - 頁首使用
<header>,連結放在有標籤的<nav>中。抽屜內有另一個<nav>,並使用不同的標籤。 - 「產品」導覽項目使用按鈕,因為它會開啟選單。彈出面板內是連結清單,可用 Tab 移到各個連結,並用 Escape 關閉。
- 在導覽列和抽屜中,都用
aria-current="page"標記目前頁面的連結。 - 在根元素上設定
scroll-padding-top: 3.5rem,讓使用者透過連結跳到標題時,標題不會被導覽列蓋住。