How to avoid text floating around images?

45 views
Skip to first unread message

helix

unread,
Aug 17, 2012, 3:08:41 AM8/17/12
to sphin...@googlegroups.com
Hi folks,

the subject says it all.

I use html output with sphinx and the text following an image is floating around it.
How can I avoid that?

I could not find anything matching at the .. image:: definition.
Perhaps, there is a simple trick or workaround?

Many regards,
Helix

Bernhard Grotz

unread,
Aug 17, 2012, 6:42:09 AM8/17/12
to sphin...@googlegroups.com

Hi,

* helix <helix....@googlemail.com> [17.08.2012 12:33]:
I use a syntax like this to include images:

Text.

.. figure:: path/to/image
:width: 50%
:align: center
:name: fig-imagename
:alt: fig-imagename

Description goes here.

Further text.

The vertical placement is defined in your CSS definitions..
search for the following code in your ``basic.css`` file:

img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}

There you can add lines like these if necessary:

margin-top: 3em;
margin-bottom: 3em;


Hope this helps.

Best regards,

Bernhard

signature.asc

Guenter Milde

unread,
Aug 18, 2012, 4:03:34 PM8/18/12
to sphin...@googlegroups.com
On 2012-08-17, helix wrote:

> [-- Type: text/plain, Encoding: --]

> Hi folks,

> the subject says it all.

> I use html output with sphinx and the text following an image is floating
> around it.
> How can I avoid that?

This behaviour is controled by CSS rules.
You can change it in a custom CSS sheet.

Günter

helix

unread,
Aug 19, 2012, 5:34:56 AM8/19/12
to sphin...@googlegroups.com, Bernhard Grotz
Hello Bernhard!


Am Freitag, 17. August 2012 12:42:09 UTC+2 schrieb Bernhard Grotz:

The vertical placement is defined in your CSS definitions..
search for the following code in your ``basic.css`` file:

        img.align-center, .figure.align-center, object.align-center {
          display: block;
          margin-left: auto;
          margin-right: auto;
        }

Hm, I expected the "display: block" to work as I wanted, but it is still the same.
I could, though, sucessfully change the width by setting "witdth: 50px;" just to be sure that I work on the correct css file.

Any other hint?

Many regards,
Helix
 

helix

unread,
Aug 19, 2012, 5:52:23 AM8/19/12
to sphin...@googlegroups.com, Bernhard Grotz
I got it!

Thanks a lot, the "align:center" works like I want.


Am Freitag, 17. August 2012 12:42:09 UTC+2 schrieb Bernhard Grotz:

        .. figure:: path/to/image
                :width: 50%
                :align: center


Many regards,
Helix
Reply all
Reply to author
Forward
0 new messages