Add custom CSS $el.setAttribute('data-tooltip', 'Copy link to this element'), 2000)" aria-label="Copy link to this element" class="headerlink" data-tooltip="Copy link to this element" href="#add-custom-css">
Customize your styles by adding CSS files or adding styles inline.
Add CSS files $el.setAttribute('data-tooltip', 'Copy link to this element'), 2000)" aria-label="Copy link to this element" class="headerlink" data-tooltip="Copy link to this element" href="#add-css-files" x-intersect.margin.0%.0%.-70%.0%="activeSection = '#add-css-files'">
To add extra CSS files, add your custom styles to a file—for example,
_static/custom.css
and add the following options to your Sphinx configuration:
html_static_path = ["_static"]
html_css_files = ["custom.css"]
Your custom CSS file is included after the theme’s default CSS.
Because of different CSS specificities,
you might need to add !important
to your CSS styles.
See also
Important
You can’t use Tailwind’s @apply
directive in custom CSS.
Use regular CSS instead.
Extend templates with inline CSS $el.setAttribute('data-tooltip', 'Copy link to this element'), 2000)" aria-label="Copy link to this element" class="headerlink" data-tooltip="Copy link to this element" href="#extend-templates-with-inline-css" x-intersect.margin.0%.0%.-70%.0%="activeSection = '#extend-templates-with-inline-css'">
If you want to add CSS inline,
you can extend the default page
template and override the extrahead
block:
{% extends "!page.html" %}
{{ super() }}
{% block extrahead %}
<style>
/* Add your CSS styles here */
</style>
{% endblock %}
Override CSS custom properties $el.setAttribute('data-tooltip', 'Copy link to this element'), 2000)" aria-label="Copy link to this element" class="headerlink" data-tooltip="Copy link to this element" href="#override-css-custom-properties" x-intersect.margin.0%.0%.-70%.0%="activeSection = '#override-css-custom-properties'">
You can override these custom properties:
--color-brand
The color for hover, focus, and highlight styles
--color-links
The color for links in the main text.
For example, to change the color of links to green, add a new CSS file or extend the templates and add the following CSS:
:root {
--color-links: green;
}
See also