Search code examples
pythonpython-sphinxrestructuredtext

how to make 2 columns with sphinx


I want to make multiple columns on my documentation.

Globally, i would like to do something similar as this homepage, where there is 3 columns : one with current release, one with news & updates, and Basics.

When i search on google about multiple columns in Sphinx, i found about splitting a list in 2 columns which is not my case

On the wiki the only things i found with multiple columns is the table, but i don't think this can apply here ?

Is this possible in rst files using Sphinx ?

Thanks a lot


Solution

  • Ok i finally found it :

    you can use container keyword in sphinx/rst files to separate things

    .. container:: twocol
    
        .. container:: leftside
    
            text on left column
    
        .. container:: rightside
    
            text on right column
    

    And then in your .css file :

    div.leftside {
      width: 43%;
      padding: 0px 3px 0px 0px;
      float: left;
    }
    
    div.rightside {
      margin-left: 45%;
      /* float: right; */
    }
    

    With this method, you can write everything you want in the container (image, links, text, ... and it will be displayed properly.