Part of the Webcore kit
HTML
<nav class="tv-webcore-sidebar tv-webcore-sidebar--grey" aria-label="Site menu">
<h3 class="tv-webcore-sidebar-title">navigation</h3>
<ul class="tv-webcore-sidebar-list">
<li><a class="tv-webcore-sidebar-link" href="#" aria-current="page">home</a></li>
<li><a class="tv-webcore-sidebar-link" href="#">about me</a></li>
<li><a class="tv-webcore-sidebar-link" href="#">art gallery</a></li>
<li><a class="tv-webcore-sidebar-link" href="#">guestbook</a></li>
</ul>
<h4 class="tv-webcore-sidebar-heading">elsewhere</h4>
<ul class="tv-webcore-sidebar-list">
<li><a class="tv-webcore-sidebar-link" href="#">webring</a></li>
<li><a class="tv-webcore-sidebar-link" href="#">cool sites</a></li>
</ul>
</nav>
CSS
/* A framed side menu: a title strip, links with pixel bullets, and the current page in navy. */
.tv-webcore-sidebar {
--tv-webcore-sidebar-face: var(--tv-webcore-pink, #f7b5e4);
box-sizing: border-box;
width: 100%;
max-width: 14rem;
margin: 0 auto;
padding: 0 4px 6px;
border: 1px solid var(--tv-webcore-navy, #2c2b9f);
background: var(--tv-webcore-paper, #ffffff);
color: var(--tv-webcore-navy, #2c2b9f);
font: 14px/1.3 "Lucida Console", "Courier New", ui-monospace, monospace;
letter-spacing: 0.03em;
box-shadow: 4px 4px 0 color-mix(in srgb, var(--tv-webcore-navy, #2c2b9f) 25%, transparent);
}
.tv-webcore-sidebar-title {
margin: 0 -4px 6px;
padding: 6px 10px;
border-bottom: 1px solid var(--tv-webcore-navy, #2c2b9f);
background-color: var(--tv-webcore-sidebar-face, #f7b5e4);
background-image: radial-gradient(color-mix(in srgb, var(--tv-webcore-paper, #ffffff) 70%, transparent) 1px, transparent 1.3px);
background-size: 4px 4px;
font-size: 13px;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.tv-webcore-sidebar-heading {
margin: 10px 6px 4px;
padding-top: 8px;
border-top: 1px dotted var(--tv-webcore-navy, #2c2b9f);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.tv-webcore-sidebar-list {
display: grid;
gap: 2px;
margin: 0;
padding: 0;
list-style: none;
}
/* Each link gets a two-pixel-square bullet that turns into an arrow on the current page. */
.tv-webcore-sidebar-link {
display: flex;
align-items: center;
gap: 10px;
min-height: 2.25rem;
padding: 0 8px;
color: inherit;
text-decoration: none;
}
.tv-webcore-sidebar-link::before {
content: "";
flex-shrink: 0;
width: 6px;
height: 6px;
background: var(--tv-webcore-sidebar-face, #f7b5e4);
box-shadow: 0 0 0 1px var(--tv-webcore-navy, #2c2b9f);
}
.tv-webcore-sidebar-link:hover {
background: color-mix(in srgb, var(--tv-webcore-sidebar-face, #f7b5e4) 45%, var(--tv-webcore-paper, #ffffff));
}
.tv-webcore-sidebar-link[aria-current="page"] {
background: var(--tv-webcore-navy, #2c2b9f);
color: var(--tv-webcore-paper, #ffffff);
}
.tv-webcore-sidebar-link[aria-current="page"]::before {
width: 0;
height: 0;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 6px solid var(--tv-webcore-paper, #ffffff);
background: none;
box-shadow: none;
}
.tv-webcore-sidebar-link:focus-visible {
outline: 2px dashed var(--tv-webcore-navy, #2c2b9f);
outline-offset: -3px;
}
.tv-webcore-sidebar-link[aria-current="page"]:focus-visible {
outline-color: var(--tv-webcore-paper, #ffffff);
}
.tv-webcore-sidebar--lilac {
--tv-webcore-sidebar-face: var(--tv-webcore-lilac, #a49bf3);
}
.tv-webcore-sidebar--grey {
--tv-webcore-sidebar-face: var(--tv-webcore-grey, #d9d9e5);
}
Usage & credits
- Use when
- Sidebar navigation on personal sites, shrines, fan pages and link hubs.
- Avoid when
- Long link lists that need search or grouping beyond two short sections.
- Requires
- Mark the current page with aria-current="page".
- From
- Luna UI