Python sphinx 对齐图标题Sphinx中的腿部文本

Python sphinx 对齐图标题Sphinx中的腿部文本,python-sphinx,restructuredtext,Python Sphinx,Restructuredtext,我无法选择对齐狮身人面像中人物的图例文本 .. figure:: check_validity.png :align: center .. Left: the source layer Right: in blue the valid layer, in green the invalid layer and in red the error layer 结果如下: 但我想让两个标题都对齐。这在不使用表格的情况下是可能的吗?是的,但这非常困难,需要自定义C

我无法选择对齐狮身人面像中人物的图例文本

.. figure:: check_validity.png
   :align: center

   ..

   Left: the source layer

   Right: in blue the valid layer, in green the invalid layer and in red the error
   layer
结果如下:


但我想让两个标题都对齐。这在不使用表格的情况下是可能的吗?

是的,但这非常困难,需要自定义CSS来说明每个图像的宽度

以下是Sphinx为我生成的HTML:

<div class="figure align-center">
    <img src="check_validity.png" />
    <div class="legend">
        <p>Some text</p>
        <p>Another sentence</p>
    </div>
</div>
您需要向CSS文件添加自定义样式:

table.table-center {
    margin-left: auto;
    margin-right: auto;
}

是否要将图像相对于页面居中对齐?对于文本,您想将其与页面或图像左对齐吗?我想将文本与图像左对齐。。你知道这是否可行吗?好的,我知道没有简单的方法可以做到这一点。我必须转向css自定义样式表。谢谢
table.table-center {
    margin-left: auto;
    margin-right: auto;
}