'How to use custom CSS on a default Sphinx theme?
I'm creating documentation in Python with the Sphinx default theme agogo
.
I would like to use the topic
directive to put a box around important information but agogo's CSS doesn't have a border in it's default CSS. I have the CSS to create the border created, but how to I include/override the old version of agogo's topic
to use my version instead.
I want to be able to generate the docs without changing the CSS manually every time. I researched a bit about using custom CSS with Sphinx but nothing seems to mention overriding an existing class.
Solution 1:[1]
Here we (ago)go:
Create a file called custom.css in the
_static
subdirectory of the Sphinx project.In custom.css, add
@import 'agogo.css';
and your own custom CSS code.Add
html_style = 'custom.css'
to conf.py (documentation).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | mzjn |