BigBoy1337
BigBoy1337

Reputation: 4973

Sphinx not over-writing css stylesheets

I have Sphinx building documentation.

In source/conf.py I have

def setup(app):
    app.add_stylesheet('conduce-style.css')

in conduce-style.css

h1 {
   font-family: 'Gotham Ultra';
}

Then when it renders:

enter image description here

See how its using alabaster.css 's style for h1 and crossing out conduce-style.css's style? I want it to always prioritize my custom stylesheet over the theme's stylesheet. How can I do this in Sphinx?

Upvotes: 0

Views: 545

Answers (1)

Steve Piercy
Steve Piercy

Reputation: 15055

CSS has rules of priority. You can try:

  • Use an equal or more specific CSS selector than alabaster's, e.g. div.body h1. More specific selector wins.
  • Slap !important at the end of your style (the sledgehammer approach).
  • Change the order in which style sheets are loading in the template theme (which would change the order in which individual styles are loaded, and the last loaded style wins).

Upvotes: 1

Related Questions