floating images are broken with docutils 0.7

Kirill Simonov avatarKirill Simonov created an issue

To reproduce:

.. image:: floating-image.png
   :align: right

A few paragraphs of regular text.

Docutils 0.7 changes the way it generates floating images: instead of using `align="right"`, it sets the style of the image element to `align-right` and provides a custom CSS rule:

img.align-right, .figure.align-right, object.align-right {
  clear: right ;
  float: right ;
  margin-left: 1em }


Sphinx needs to replicate the new rules in its stylesheets.

Comments (6)

  1. Anonymous

    Hi, I just ran into this problem, the patch seemed to help with the alignment but image scaling seems to be broken as well. (sphinx 1.0.4, docbook 0.7)

    .. image:: images/screenshots/1024x768/menu.png :scale: 50 % :alt: screenshot :align: right


    thanks, Hamish

  2. Philippe Pinard

    The class .align-right, .align-left, .align-center in basic.css of the basic theme should be:

    .align-center {
        display: block; 
    .align-right {
        float: right;
    .align-left {
        float: left;
  3. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.