Forum:Is it possible to add background images to table cells?

And by 'background images', I mean images that work as the background 'layer' of the table, while the text or generally data that is added on the table's cells appear idividually from that background, acting as a different 'layer'.


 * Um, that's exactly what you would do.  Not sure what you're asking, since you've kinda answered your own question.  You just set the   of your   class to be the image you want.  Best done through CSS, though.  If you don't have admin rights on your wiki, and are therefore forced to do it completely in the "ordinary" spaces of the wiki, you're gonna be talking quite the little code dump to achieve it.


 * Please provide more details about your user rights on the wiki in question, as well as your level of familiarity with wikicode and/or CSS so an answer tailored to your needs can be provided. 14:25: Fri 18 May 2012


 * Well, I while am an admin, I am afraid that I'm just getting started on Wikis, and therefore know very little concerning Wikicode.


 * Thanks for the help so far, but I am not quite sure how I can set the . If you are referring to the source code of the table itself, and that I just have to add   in  , well that didn't seem to work.


 * Using admin privileges to edit the CSS pages is the only way to add a background-image to an element in a wiki. In-line CSS styling won't work for that. Check out this page for more information about using CSS for background images: http://www.w3schools.com/cssref/pr_background-image.asp
 * When you want to add a background image to an element, you have to edit the MediaWiki:Wikia.css on your wiki. For instance, if you wanted to give a background image to just the header cells of all tables, you would add this to the Wikia.css:


 * However, the code above would affect all tables. If you want to set the background image for only a specific type of table, you would give that table a unique class, like this:


 * And then you would refer to that class in the css, like so:


 * In your actual code, you would replace  with the actual url of your image. --Gardimuer { ʈalk } 15:55, May 18, 2012 (UTC)

[Sorry if this is redundant of the above, but I've spent time typing it up, so I might as well publish it.]

Okay, I wouldn't bother trying to do it inline like you're trying to do. I would do it through CSS. So, I'd throw the whole table into css. Let's imagine that we're going to create a table called "background-image". We would then style all the elements of the table — corresponding to the html tags would show up across all the rows and columns of your table body. And you'd have no impenetrable code in the table on your page. It's all tucked away neatly in the table.background-image definitions you've done in your css.

Oh, a word about getting the right url for the image. You have to go to and click on the image until it's the only thing on the page, surrounded entirely by white. The favicon in the URL bar will turn into a yellow "wikia w". Then you have to cut and paste that URL into the tbody tt definition line. 16:18: Fri 18 May 2012


 * There is an easier way... much more easier than what CzechOut stated. You can create separate background images classes by defining each one of them in your Common.css filepage. Defining these classes can be anything, from "wallpaper1" and "mainpagebackgroundimage1" to "coolbackground1" and "awesomenesspic1" as long as it does not conflict with existing classes. Let's take Dead Space Wiki's Common.css page as an example:

.wallpaper1 { background: url("http://images2.wikia.nocookie.net/deadspace/images/3/31/Dead_Space_by_HDspring.jpg") no-repeat center top !important; } .wallpaper2 { background: url("http://images1.wikia.nocookie.net/deadspace/images/8/86/Dead_Space_2_by_Jessada_Nuy.jpg") no-repeat center top !important; } .wallpaper3 { background: url("http://images1.wikia.nocookie.net/deadspace/images/e/e7/DeadSpace_-_Userpage.jpg") no-repeat center top !important; }
 * As CzechOut said, background images will be added/loaded to a table if it is defined in the class field . So, to load up the background image of wallpaper1, just add in.
 * You can have different background images for tables if you do this way. :) — subtank  ( 7alk ) 16:32, May 18, 2012 (UTC)
 * Oh, if "background: url(blah blah blah)" doesn't work, use "background-image url(blah blah blah)" instead. :) — subtank  ( 7alk ) 16:33, May 18, 2012 (UTC)


 * While all of what you Subtank says is true, the disadvantage is that the only thing this class=wallpaper method will allow you to do is to define the image for the entire table. You can't, in my experience, add two class statements in normal wikitable markup (i.e. with pipes), so if you only defined the class relative to an image, you'd have to separately style each row, column, header, etc. within the inline markup of the table.  Ultimately, in my view, this would not be easier, particularly if you wanted to define cell border tops and bottoms to create a grid.


 * Moreover, Subtank's method may not be appropriate to your needs, since the background would be for the entire table, incluing the table headers. By strictly defining the image to the tbody, the picture will not interfere with the header row (or, if applicable, the footer row).


 * It all really depends on what you want.  16:58: Fri 18 May 2012


 * Alright, thanks everyone. Definitely a lot of food for thought. I will study your instructions and the tutorials that you have linked to me and will use them accordingly.