Last active
December 20, 2015 05:08
-
-
Save apexskier/6075571 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some notes about working with reStructuredText. Specifically, this is in the | |
context of the `WWU University Residences website <http://housing.wwu.edu>`_, | |
which has .rst files driving most of it's static content and is using | |
responsive `Bootstrap <twitter.github.io/bootstrap/>`_ for css styles and | |
framework. | |
========== | |
Fluid Rows | |
========== | |
It's often useful to put fluid rows inside of your content. This allows for | |
multiple columns without much worry about adding extra css or using raw html in | |
your reStructuredText. There are a couple methods you can try to accomplish | |
this. | |
Using Sections | |
.............. | |
This actually doesn't work very well, and is undesirable. | |
The header that the ``row-fluid`` class is applied to ruins bootstrap's | |
span styling. Bootstrap expects the first element inside of a fluid row to have | |
a ``span`` class, so it can give it a margin-left of zero. The section header | |
is there instead, so each of the spanning elements has a margin and the last | |
one is pushed below the rest. This can be worked around by making the spanning | |
elements sum to 11 instead of 12, but doesn't look great. | |
Also, the fluid row must be followed by another section of a higher level than | |
the fluid row section. Any content before that will end up in the final column. | |
---- | |
.. class:: row-fluid | |
My fluid row | |
************ | |
.. class:: span4 | |
A fluid column | |
^^^^^^^^^^^^^^ | |
This column contains everything within the "A fluid column" section. The | |
``span4`` class is applied to the entire section. | |
.. class:: span3 | |
Column two | |
^^^^^^^^^^ | |
This column is also it's own section, same level as the previous column. | |
.. class:: span4 | |
Final Column | |
^^^^^^^^^^^^ | |
These can have child sections within them. | |
Minor thought | |
------------- | |
And.... done! | |
---- | |
Using containers | |
................ | |
This method uses rst's `container directive | |
<http://docutils.sourceforge.net/docs/ref/rst/directives.html#container>`_. | |
It works well because you can stick it anywhere and it doesn't mess with any | |
section stuff. The downside is that you can't stick headers (sections) inside | |
it. | |
---- | |
.. container:: row-fluid | |
.. container:: span4 | |
Here's column 1. It's not got **that** much cool stuff in it, but you | |
can still use rst directives! | |
.. image:: http://placekitten.com/g/26/74 | |
:alt: Uber kute kat | |
:class: img-rounded | |
.. container:: span4 | |
Here's a second column. As you can see, a lot of rst syntax can be | |
included. | |
.. container:: span4 | |
+-------------------------+ | |
| A simple table | | |
+============+============+ | |
| Col1, Row1 | Col2, Row1 | | |
+------------+------------+ | |
| Col1, Row2 | Col2, Row2 | | |
+------------+------------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment