0
votes

I tried every solution i found but none of it works. Maybe cause of differences in Python 2 or 3, and/or older Sphinx version. This is what I have:

  1. A Sphinx project with a seperated build and source directory
  2. A file called custom.css which I placed in source/_static. Content:
    .blue {
        parent: bodytext;
        textColor: blue;
    }
  1. I've edited my conf.py and added html_css_files = ['custom.css'] below html_static_path = ['_static']

  2. I've added .. role:: blue at the top of my *.rst document.

  3. I've edited the file itself and wrote: This is a sentence with a :blue:`blue` word.

When I render my project the html source code contains: This is a sentence with a <span class="blue">blue</span> word.

All good except the fact the word isn't blue at all. It has the same color as the rest.

What am I missing?

1
When you build the docs, does the file custom.css get copied over to the build directory? Do you see any 404s for that file in your browser's developer tools? - Steve Piercy
Yes, it does. It lives in html/_static/custom.css. And as far as I can say there isn't any 404 in the dev tool section. - Christian

1 Answers

0
votes

Your CSS syntax is incorrect. This should do it.

.blue {
    color: blue !important;
}