Wikia

Community Central

Admin Forum:No Break?

Talk0
92,126pages on
this wiki

This Forum has been archived

Forums: Admin Central Index Technical Help No Break?
Wikia's forums are a place for the community to help other members.
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: 257Text. The problem is, sometimes the template is spaced just so in an article that the line wraps 257between 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: 257 Text. :) STARFLEET ACADEMY 07:38, June 5, 2012 (UTC)
That's just the thing... in the case of my template, using a space of any kind would ruin the alignment. I was hoping for a way to somehow "bind" the image and parameter together, if possible. Dzylon  Talk  08:10:04  June 05, 2012
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)
Hm, I'll test that. Thanks :). Dzylon  Talk  08:42:47  June 05, 2012
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)
Thanks for the code. I think later I'll try working out a CSS implementation, so it'll load faster. I think there should be a way to do it using the :before pseudo-element, but I can't get it to work (I have no experience in this). Dzylon  Talk  09:41:23  June 05, 2012

(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)
Yep, I tried both of those. The CSS doesn't work (not sure why) and the wrap:none selector creates a whole new line. Dzylon  Talk  04:39:23  June 05, 2012
"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 code white-space:nowrap; inside of a <span> tag, like this:
<span style="white-space:nowrap;">[[File:257.png|14px|link=]]{{{1|}}}</span>
--Gardimuer { ʈalk } 21:45, June 5, 2012 (UTC)

┌───────┘
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)

Around Wikia's network

Random Wiki