Skip to content

Collapse Headers? #8103

Answered by mocdaniel
MartinGonzalez asked this question in Q&A
Mar 19, 2025 · 2 comments · 7 replies
Discussion options

You must be logged in to vote

Yup - you can use custom additional CSS.

Put the following in a file docs/stylesheets/extra.css (or extend the file at docs/stylesheets/custom.css you already seem to have, according to the config you shared):

nav[data-md-level="0"] > .md-nav__list > .md-nav__item {
  border-bottom: 1px solid;
  border-color: #36383F; /* picked the color from your screenshot */
  padding-bottom: 4px;
}

Then reference the file in your mkdocs.yml:

extra_css:
  - stylesheets/extra.css

Desktop

Mobile

Regarding the last part of the questions (how not to descend into the subsection menu on mobile devices) - this goes deeper into the inner workings of the nav partial and possibly also Javascript, so it's out o…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@Martin-Gonzalez90
Comment options

@mocdaniel
Comment options

@MartinGonzalez
Comment options

@mocdaniel
Comment options

Answer selected by MartinGonzalez
@MartinGonzalez
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants