[Mediawiki-l] how to get a non-breaking space between text and a graphic?

Brion Vibber brion at wikimedia.org
Wed Aug 6 22:35:36 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Derrick Farnell wrote:
> Placing a non-breaking space -   - between text and a graphic doesn't
> seem to work. That is, on this page:
> 
> http://www.chainsofreason.org/wiki/Chain_32
> 
> gradually reducing the width of the browser window eventually causes the
> arrow graphic to jump down a line without taking with it the word which
> comes before it, even though the space between them is a non-breaking one
> (in the case of the first arrow on the page). The arrow doesn't make sense
> unless it is preceded by at least the last word of the preceding sentence.

Most (all?) browsers will happily break between a letter or non-breaking
space and a separate element such as an image.

You can however wrap the combination of both in a style which disables
breaking:

<span style="white-space:nowrap">thinks. [[Image:Conclusion
arrow.png]]</span>

(A template can cut down the amount of text you write there.) I'm not
sure there's a good way to do this that doesn't require you to pick a
previous word; wrapping just the image in the nowrap style will probably
still break just before the span, but go ahead and test it in case I'm
wrong!)

- -- brion
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkiaJzgACgkQwRnhpk1wk45BEQCbBx+WvLwsBZ8byEN8A82VeAtj
f1QAn2XNSMwDJ3w4NfqHbo1IBG6rUuQO
=s7P1
-----END PGP SIGNATURE-----



More information about the MediaWiki-l mailing list