0

我尝试了我找到的所有解决方案,但没有一个有效。可能是 Python 2 或 3 和/或旧 Sphinx 版本的差异的原因。这就是我所拥有的:

  1. 具有独立构建和源目录的 Sphinx 项目
  2. 我将一个名为 custom.css 的文件放在 source/_static 中。内容:
    .blue {
        parent: bodytext;
        textColor: blue;
    }
  1. 我编辑了我的 conf.py 并在html_css_files = ['custom.css']下面添加html_static_path = ['_static']

  2. 我已.. role:: blue在 *.rst 文档的顶部添加。

  3. 我已经编辑了文件本身并写道:这是一个带有蓝色单词的句子。

当我渲染我的项目时,html 源代码包含This is a sentence with a <span class="blue">blue</span>

一切都很好,除了这个词根本不是蓝色的。它与其他颜色相同。

我错过了什么?

4

1 回答 1

0

您的 CSS 语法不正确。这应该这样做。

.blue {
    color: blue !important;
}
于 2020-09-18T03:29:01.663 回答