Applying CSS and roles for text blocks instead of inline spans in Sphinx

旧时模样 提交于 2019-12-04 00:51:03

There are a number of ways to do this, but one of them is to use the class directive:

.. class:: red

    This is a paragraph.

    This is another paragraph.

Most docutils HTML writers will put that into html output as a class html attribute, which you can then style with CSS.

In Sphinx, in particular, however, you may need to use rst-class instead of class in at least some cases. See: http://sphinx.pocoo.org/rest.html#id3

Also, many block-level elements in RestructuredText take a :class: parameter which does pretty much the same thing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!