我在文档中使用了'Read the Docs‘Sphinx主题。在原始主题中,如下所示
http://read-the-docs.readthedocs.org/en/latest/theme.html
内容或主布局宽度设计为移动友好。然而,对于我的项目,我希望这个范围更宽一点。我不知道HTML,因此,如果有人能给我一些线索来增加内容(布局)宽度,我将不胜感激。
发布于 2015-11-10 16:57:09
另一种选择是在source/_static
中创建一个仅包含所需样式表的样式表,例如
.wy-nav-content {
max-width: none;
}
或
.wy-nav-content {
max-width: 1200px !important;
}
确保在source/conf.py
中引用了该目录-我相信默认情况下会有一行执行此操作,即
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
然后在source/_templates/layout.html
中创建自定义布局,并执行以下操作以包含样式表
{% extends "!layout.html" %}
{% block extrahead %}
<link href="{{ pathto("_static/style.css", True) }}" rel="stylesheet" type="text/css">
{% endblock %}
假设您将样式表命名为style.css
发布于 2015-10-02 07:40:58
这里的解决方案有点老套。如果你想包含样式,并有一个css覆盖,让它在RTD上工作,你会想要这样的东西。
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_style = 'css/custom.css'
else:
html_context = {
'css_files': [
'https://media.readthedocs.org/css/sphinx_rtd_theme.css',
'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
'_static/css/custom.css',
],
}
我自己测试过,它似乎在本地和RTD上都可以工作。大量抄袭自https://blog.deimos.fr/2014/10/02/sphinxdoc-and-readthedocs-theme-tricks-2/
发布于 2014-04-30 03:59:22
我会在css中对其进行修改。您应该搜索文件theme.css (它位于“sphinx_rtd_theme/static/css/teme.css”的文档源码中)。
复制该文件并将其放入您的sphinx _static目录中。在css文件中,您可以进行所需的所有布局更改。(如果您从未使用过css文件,则可能需要阅读一些有关css文件的内容。)
希望这能有所帮助。
https://stackoverflow.com/questions/23211695
复制相似问题