Admin Forum:No Break?
Talk0this wiki
This Forum has been archived
To contact staff directly or to report bugs, please use Special:Contact.
How would I go about keeping two objects (an image and a parameter) together? Nothing I've found seems to work how I want. I'll use some random image as an example.
[[File:257.png|14px|link=]]{{{1|}}}
...yields this:
Text. The problem is, sometimes the template is spaced just so in an article that the line wraps
between the image and the text. How do I prevent this? Dzylon Talk 07:07:43 June 05, 2012
- Hi. You could use
Which renders a non-breaking-space, like so:
Text. :) STARFLEET ACADEMY 07:38, June 5, 2012 (UTC)
- Eek, I'm not quite sure what you mean. May I have a link to the template? :) STARFLEET ACADEMY 08:22, June 5, 2012 (UTC)
┌───────┘
Link. I'm looking for a way to prevent the image and unnamed parameter #1 from separating (via line wrap) under any circumstance, preferably without using a table of some kind. If there's no other option, that may be what I'll have to go with. Dzylon Talk 08:27:30 June 05, 2012
- Hmm. Have you thought about using CSS? My idea: Remove the image completely, and then give the
{{{1|}}}a spanned class, then add the image before:
.class { padding-left: 14px; background: url('href'); }
- STARFLEET ACADEMY 08:41, June 5, 2012 (UTC)
- I'll have a look into it too. Sorry about the typo. :P STARFLEET ACADEMY 08:45, June 5, 2012 (UTC)
- I was right the first time! Try this:
$(function() { $('.gpicon').before('<img src="http://images2.wikia.nocookie.net/__cb20120517203404/infinityblade/images/a/a8/Gp-icon.png" />'); });
- It works for everything from 2 to 500! :D STARFLEET ACADEMY 09:05, June 5, 2012 (UTC)
(Reset indent) Yeah, load times can be a pain with js. Try this (I haven't got time to test it):
.class:before { background: url('http://images2.wikia.nocookie.net/__cb20120517203404/infinityblade/images/a/a8/Gp-icon.png'); }
I haven't used :before myself though! :) STARFLEET ACADEMY 10:21, June 5, 2012 (UTC)
- What about
<div style="wrap:none">
~ Flightmare 11:51, June 5, 2012 (UTC)
- "
wrap" is not a valid CSS property. Flightmare's code created a new line because the<div>tag is a block level element. Instead, you should use the CSS codewhite-space:nowrap;inside of a<span>tag, like this:
- "
<span style="white-space:nowrap;">[[File:257.png|14px|link=]]{{{1|}}}</span>
┌───────┘
That works perfectly, Gardimuer. Thanks to all who posted. Dzylon Talk 10:01:03 June 05, 2012
- Ahh, great one Gardimuer. I didn't think that would work because there was no space! :P STARFLEET ACADEMY 03:15, June 6, 2012 (UTC)