NIWA Community Forums

NIWA Community => Wiki References => Topic started by: embyr_75 on September 03, 2013, 06:37:00 PM

Title: Creating new Classes?
Post by: embyr_75 on September 03, 2013, 06:37:00 PM
Hey Wiki People,

I'm trying to replace some old content on Metroid Wiki's front page and need to know how to create a new class.

If you look at the main page, you'll notice there are several "semi-transparent" images (one in the "news" box, and one in the "featured article" box). I believe these are implemented using a class="namehere", and I don't know how to reproduce it for the latest feature.

Hate to be a bother with my wiki illiteracy, but I'm impatient and my code-savvy admins are busy people.  ::)
Title: Re: Creating new Classes?
Post by: Tucayo on September 03, 2013, 07:27:39 PM
I'm not exactly code-savvy, but I think I can help you here.

By viewing the source of the Main Page you can see each box has its own class ("news", for example, is the class of the News box). If you go to MediaWiki:Common.css (http://www.metroidwiki.org/wiki/MediaWiki:Common.css), you'll see the classes are listed here; here's what "news" says:

Code: [Select]
.news {
  background-image:url('http://cdn.wikimg.net/metroidwiki/images/f/fb/News_mainpage.png');
  background-repeat:no-repeat;
  background-position: center center;}

If you want to create a new class for a new feature, all you'd have to do is something like this:

Code: [Select]
.<class name here>{
  background-image:url('<background image here>');
  background-repeat:no-repeat;
  background-position: center center;}

I believe the images themselves (http://cdn.wikimg.net/metroidwiki/images/2/2f/Featured_Article.png) are made semi-transparent beforehand.
Title: Re: Creating new Classes?
Post by: embyr_75 on September 03, 2013, 07:58:43 PM
AHA! Most excellent!  ;D Thanks so much! That should work perfectly.

... I really need to learn to start figuring out this MediaWiki stuff myself.  :-[
Title: Re: Creating new Classes?
Post by: KidIcarus on July 07, 2015, 11:29:42 PM
I'm curious now... what kind of classes are you thinking of making?