8000 docs: Improve docs about CSS customization · melissawm/mkdocstrings-python@9f8456a · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9f8456a

Browse files
committed
docs: Improve docs about CSS customization
Issue-48: mkdocstrings#48
1 parent d6e1d68 commit 9f8456a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/usage/customization.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ and/or by overriding templates.
55

66
## CSS classes
77

8+
Our templates add [CSS](https://www.w3schools.com/Css/) classes to many HTML elements
9+
to make it possible for users to customize the resulting look and feel.
10+
11+
To add CSS rules and style mkdocstrings' output,
12+
put them in a CSS file in your docs folder, for example in `docs/css/mkdocstrings.css`,
13+
and reference this file in [MkDocs' `extra_css` configuration option](https://www.mkdocs.org/user-guide/configuration/#extra_css):
14+
15+
```yaml title="mkdocs.yml"
16+
extra_css:
17+
- css/mkdocstrings.css
18+
```
19+
20+
Example:
21+
22+
```css title="docs/css/mkdocstrings.css"
23+
.doc-section-title {
24+
font-weight: bold;
25+
}
26+
```
27+
828
The following CSS classes are used in the generated HTML:
929

1030
- `doc`: on all the following elements
@@ -22,6 +42,8 @@ The following CSS classes are used in the generated HTML:
2242
- `doc-labels`: on `span`s wrapping the object's labels
2343
- `doc-label`: on `small` elements containing a label
2444
- `doc-label-LABEL`: same, where `LABEL` is replaced by the actual label
45+
- `doc-section-title`: on section titles (depend on the [selected style for section rendering][docstring_style])
46+
- `doc-section-item`: on section items (depend on the [selected style for section rendering][docstring_style])
2547
- `doc-md-description`: on `div`s containing HTML descriptions converted from Markdown docstrings
2648
- `doc-symbol`: on `code` tags of symbol types
2749
- `doc-symbol-heading`: on symbol types in headings

0 commit comments

Comments
 (0)
0