Files
leecat.art/css/post-toc.css
T
inherentlee 06bcfc1522
continuous-integration/drone/push Build is passing
toc tree styling
2026-09-20 18:46:09 -07:00

94 lines
1.6 KiB
CSS

#toc {
float: right;
margin: 1rem 0 1.5rem 1.5rem;
/* 23rem is the width of the words 'table of contents' in my header font */
/* yes, it's a bit hacky */
width: min(calc(100% - 1.5rem), 23rem);
}
@media (max-width: 850px) {
#toc {
float: unset;
margin-top: 2rem;
margin-left: .5rem;
width: calc(100% - .5rem);
}
}
#toc details {
border: thick solid var(--color-pink);
border-radius: 1rem;
margin-top: 1rem;
}
#toc summary {
position: relative;
top: -1.5rem;
left: -.75rem;
width: fit-content;
background: var(--color-bg);
border-radius: .5rem;
cursor: pointer;
}
#toc summary:focus-visible {
outline: .15rem solid var(--color-teal);
}
#toc summary::marker {
font-size: 2.35rem;
}
#toc h2 {
margin-top: 0;
display: inline;
line-height: normal;
}
#toc nav {
position: relative;
top: -1.25rem;
}
/* my baby my child my `tree` list styling */
#toc ol,
#toc li {
margin-block: 0;
}
#toc ol {
margin-left: 0;
list-style: none;
}
#toc li {
border-left: .095rem solid var(--color-pink);
line-height: 1.2;
margin-left: 1.5rem;
}
#toc li::before {
content: '├─';
color: var(--color-pink);
position: relative;
left: -.34rem;
}
#toc li:last-child {
border-left-color: transparent;
}
#toc li:last-child::before {
/* Technically, we could use this content for all of them, but doing the full
bar for the non-last-childs keeps the border a *smidge* more consistent for
different levels of magnification */
content: '└─';
}
/* underlines are unnecessary in this context */
#toc a {
text-decoration: none;
color: var(--color-blue);
font-weight: bold;
}