Forum:How do I change my wikitable background color?

ShoutWiki — express yourself and be heard!
Jump to navigation Jump to search

Forums: Index Community help


Hi! I just created a new wiki (it is private, will I need to send the link to someone?) and am in the process of giving myself a crash course on css, javascript, and some of the other coding process used on this website - my previous coding experience is pretty much limited to editing pre-made coding in the heaters and footers of ProBoards forums, if that helps put things into perspective.

One thing that I've been having difficulty with is changing the background color of the the tables I've cobbled together using the wikitable class. I'm at my wit's end trying to figure out how to get the changes to stick, and nothing seems to work -- I feel like I just haven't found the right place to stick something, and I'm hoping someone in the forum can help :-)

Below is an example of the tables I've been using:

{| class="wikitable" style="width:97%; text-align: justify; border-spacing: 2px; margin-left: auto; margin-right: auto;"
|- 
! [[Prehistoric Era]]
! [[Era of Myth and Legend]]
! [[Era of the Empire]]
! [[Current Era]]
|}

—The preceding unsigned comment was added by Nocens (talkcontribs) 03:35, 10 January 2016‎. Please sign your posts with --~~~~!

Hi Nocens and welcome to ShoutWiki! :-) We're glad that you chose ShoutWiki; the MediaWiki software that we use is very powerful, but getting started can be a bit tricky at times. That's why we are here to help you out!
Providing a link to your wiki here will save us staff members a few clicks, but it's not strictly necessary as we have the technical means to list all wikis created by a specific user. For non-staff users, the tool in question — Special:MyWikis — lists all the wikis they've created, but staff are able to view all users' wiki creations.
The first thing you need to figure out is this: for what skin(s) you want to apply the change? Your wiki seems to be using the MonoBook skin with the dark theme. I'm guessing that applying the desired color change just for the MonoBook skin is what's wanted, as the default colors will likely work just fine with other skins, such as Monaco or Nimbus.
As an administrator, go to the page called 'MediaWiki:Monobook.css on your wiki. This page allows administrators (and other privileged users, such as ShoutWiki staff) to customize the CSS applied to the MonoBook skin; the respective page for customizing JavaScript is at MediaWiki:Monobook.js.
Something like this in MediaWiki:Monobook.css should work to change the background of tables which have the wikitable class to black (#000 is the hex code for black; more info can be found on Wikipedia, for example):
table.wikitable > tr > th, table.wikitable > * > tr > th {
	background-color: #000;
}
Try it out and let me know how it goes. Best of luck with your new wiki and don't hesitate to ask for help — we are here for you! :-) --Jack PhoenixShoutWiki Staff (Contact) 15:03, 10 January 2016 (UTC)

Hey, this was very helpful, thank you so much!

Nocens (talk) 18:27, 10 January 2016 (UTC)