From the Nintendo Wiki, a wiki covering all things Nintendo
Jump to navigationJump to search
  1. Many of the codes shown on this page can be used as table styles.

CSS (officially known as Cascading Style Sheets) sets how a page looks. On a special subpage of your user page, you can override the MonoBook skin to create your own personal look for the wiki.


CSS has three parts: A selector is the variable (officially the HTML element you're editing). A property is the attribute of the element you want to change. Each property has a value, which is what you set to change the style of the selected element.

Consider the following line:

body {
	color: #00FF00;

The selector/element that was edited was body - all the general text on a page. The property/attribute was color - text color. The value was #00FF00 - making all text a green color.

Note the syntax for CSS. The selector is defined first, then an opening brace ({) "opens" the element for editing. Then the property appears, with a colon (:) after it, then the value (hex colors must have the # sign). Each time a value is set, a semicolon (;) is required at the end (except for the last line). Multiple lines of properties and redefined variables can occur within the curly braces ({ }), and all affect the same selected element.

selector {
	property1: value;
	property2: value;
	property3: value;

It is also possible to apply values to the properties of multiple selectors at once, separating them with a comma (,):

selector2 {
	property: value;


Let's take a look at the "body" and "a" selectors:

body { font-family: Arial; font-size: 10px;}
a { color: #080; text-decoration: none; }
a:visited { color: #050; }
a:active { color: #111; }
#p-personal { color: #b00; }
#p-personal { color: #800; }
#bodyContent a.external { color: #0a0; }
#bodyContent a.extiw:active { color: #020; }
  • The body selector covers the basic text on any page (such as what you'd see as content on a wiki page).
  • The a selector is the basic link that hasn't been clicked on recently.
  • a:active is when you are in the midst of clicking the link.
  • a:visited is the link that has been clicked recently. Often, it is simply the same color, but darker than a.
  • #p-personal is the wiki-unique link-that-hasn't-been-created (red) link.
  • #p-personal is when you try to create a page, but don't right away, so it has a different color elsewhere until it's created, when it becomes a.
  • #bodyContent a.external is the external link.
  • #bodyContent a.extiw:active is when an external link is being clicked on.
  • Result: Normal text is changed from 12px Verdana to 10px Arial. The normal and external links are now green. When clicking on a link, the color is a dark shade of green or gray. The uncreated page links are a darker shade of red.
  • In the first example, different parts were on different lines. In fact, all of it can be on one line if you so choose. Incidentally, there is no need for a space in between the colon and the value as well.


Simple selectors[edit]

There are three main types of selectors: HTML elements, classes, and IDs. These are as follows:

  • Elements select plain HTML tags, such as <a> and <img>. The selector is simple the text inside the angled parentheses, such as a and img.
  • Classes are properties that almost any HTML element can be given, and define it with a given name. To select an element of a certain class, append the class name with a dot, like .classname.
  • IDs are similar to classes, but can only occur once on the page. Select them with a hash symbol (#), like #idname.

Since element selectors refer to HTML tags, they are common on all websites; classes and IDs, however, are different on every site, and those used in wikis will only work in wikis. Keep in mind that some selectors will only take certain values (experiment!). The following is a table of some important simple selectors for wiki skins:

Selector Element(s) selected
body contains the entire page
a anchor elements (links)
p paragraphs; on a wiki, <p> tags are inserted automatically.
pre the content in pre tags
textarea large input areas for text, including the edit box.
ul unordered (bullet) list
ol ordered (numbered) list
li list item
h1, h2, h3, h4, h5, h6 headers matching the number of = symbols used in wikisyntax; page titles are h1 and sidebar headers are h5
select dropdown menus
input most kinds of input, including small text fields, buttons, checkboxes and radio buttons
img images
.usermessage the message table that appears when your talk page has been revised
#content the article content area
#p-personal the user links at the top-right of the page
#p-cactions page tabs; use #p-cactions li for individual tabs or #p-cactions li a for the links in each tab
#p-logo contains the logo; change the background-image property of #p-logo a to change the logo image
#siteNotice as says
#catlinks table at the bottom of categorised articles containing categories it's in
#toc table of contents
#wpTextbox1 the edit box
.searchButton the "Go" and "Search" buttons in the sidebar
#searchInput the search box text field
.portal includes user links, page tabs and sidebar boxes
.pBody sidebar boxes, not including the header
#p-search the sidebar's search box
#p-tb the sidebar's toolbar box
#footer the banner-like footer at the bottom of every page

Compound selectors[edit]

Selectors can be put together to choose, say, every link that is inside a paragraph element; this is done using spaces, so those links could be selected using p a. The second selector does not have to be directly inside the first, only somewhere within it, and it is also possible to use three selectors together, or more.

Advanced selectors[edit]

Firstly, there are pseudo-classes. These are not really there, and are "created" by the CSS. A normal element must be used for the pseudo-element to be based on, and these are separated by a colon (:). For example:

a:hover { color: #aaa; }

makes links gray when the cursor hovers over them. The following is a list of some useful pseudo-classes:

Selector Effect
:hover as seen above, applies style when element is hovered on. In Internet Explorer, this only works for links.
:active selects elements that currently have focus, such as buttons, text fields and links that have just been clicked
:visited selects previously visited links
:first-child applies the style if the element is the first element in what contains it
:last-child applies the style if the element is the last element in what contains it
:before puts text before the element using the content property
:after puts text after the element using the content property

Next, + and > can be used to select elements more precisely. For example:

ul + p { border-top: 1px solid #aaa; }

puts a solid gray border at the top of every paragraph directly after an unordered list, and:

ul > li { background-color: #ddf; }

gives a light blue background to every list item directly inside an unordered list - as opposed to being in an element that itself is inside the <ul> tag.

Finally, the wildcard (*) can be used to select any element. For example, p * selects every element in a paragraph.

List of properties and values[edit]

See also: Help:CSS/Properties and values

This is a list of some useful properties and some of the most important values that they take. Some values are measurements, and take units; those described here are possible options:

  • % - measured as a percentage of the container size (for width, height, padding, margin) or font size (for font-size).
  • em - measured in terms of the browser's set font size, where 1 is default and anything lower or higher varies the size proportionally. Allows the values for width, height, padding and margin to be defined relative to the font size.
  • px - measured in pixels, the smallest measurement on a display.
  • pt - only vaguely useful for fonts, where it resizes it as it would appear in a word processing program.

Some properties, such as border ones, padding and margin, take up to four values, one for each side of the element. by adding -top, -right, -left or -bottom to the property, the value for one of these can be defined. Leaving the property as it is means values are defined as follows:

  • 1 value: value is for all sides.
  • 2 values: first value is for top and bottom, second value is for right and left.
  • 3 values: first value is for top, second for right and left, third for bottom.
  • 4 values: assigned in the order top, right, bottom, left.

Some properties take a color value. This can be either:

  • A pre-defined color name (check out this list);
  • a hex color in the form #000000 or #000, where each digit is a hexadecimal digit representing red, green or blue; or
  • rgb(red, green, blue), where red, green and blue are numbers up to 255 or 100%; or
  • hsl(hue, saturation, luminance), where hue is number up to 360, and saturation and luminance are numbers up to 100%.
Property Description Possible values
font-family the font or font face used Common examples are times, verdana, helvetica, arial, serif and sans-serif. A comma-separated list lets the browser choose the first one it has access to.
font-size self-explanatory takes a measurement
font-style sets italics normal, italic, oblique
font-variant sets small-caps normal, small-caps
font-weight sets bold normal, bold (other values are possible, but barely distinguishable - bolder, lighter a number up to about 1000)
font sets multiple font attributes together the order font-style, font-variant, font-weight, font-size, font-family: font: italic small-caps lighter 13px Arial;
text-align self-explanatory left, center, right, justify
text-decoration sets underline none, underline, overline, line-through
text-transform sets caps none, capitalize, uppercase, lowercase
color sets text color takes a color value
border-color takes a color value
border-style none, dotted, dashed, solid, double, groove, ridge, inset and outset
border-width thin, medium, thick; or takes a measurement, suggested that they are only positive and integers if pixels - decimals such as 1.5px causes two sides to be 1px and two sides to be 2px
border1 -top, -left, -right and -bottom are used to set side borders individually used to define width, style and color in one declaration: border: 1px dashed black;, border: 2px solid #289;
background-color takes a color value
background-image takes a complete url or a color value preceeding a URL - background: url(; or background: #055 url(;. In the latter case, the color is shown if the image cannot be found, and it shows through transparent or translucent images.
background-repeat repeating pattern of a background image repeat, repeat-x, repeat-y, no-repeat; with x being repeating horizontally only and y being repeating vertically only.
background-attachment sets whether a background image scrolls with the page or not scroll, fixed
background sets multiple background properties at once e.g. background: #0ef url(img.jpg) no-repeat fixed;
margin sets the spacing of the element, the distance it pushes neighboring elements away. -top, -left, -right and -bottom are used to set side margins individually. takes a measurement, can be negative
padding sets space inside an elements border, between that and its contents. -top, -left, -right and -bottom are used to set side padding individually. takes a measurement
list-style-image sets the bullet image of list items in a ul element url(url);, none to remove the bullet
list-style-type sets the numbering type of list items in an ol element decimal (default), lower-roman (i, ii, v), upper-roman (I, II, V), lower-alpha (a, b, c), upper-alpha (A, B, C), none to remove the number
border-radius rounds an element's corners takes a measurement
content used with :before and :after pseudo-elements open-quote

, close-quote , "text" , url(URL of an image)

display defines how element is displayed on the page inline (in line with other elements), block (with line-breaks before and after), none (completely hides the element)
visibility hidden (element is replaced with whitespace, so it takes up space but isn't displayed)
overflow defines what happens to content that doesn't fit in an element; the width and height of the element must be set hidden (overflow isn't shown at all), auto (scrollbars are shown so that the overflow can be scrolled down or across to), visible (overflowing content is displayed outside the element)
width, height defines the width or height of an element if the display property has the block value takes a measurement
letter-spacing normal or a measurement
word-spacing normal or a measurement
line-height the height of each line of text in a paragraph normal or a measurement
text-indent defines the indentation of the first line of a paragraph of text takes a measurement
float pushes an element to one side so that following content can flow around it left, right, none
clear moves content following a floated element past it, to the first free line left, right, both (defines types of floated elements that should be cleared)
position allows positioning of an object in different ways, using top, bottom, left and right properties static (default), relative (offsets element's position from where it is by default), absolute (positions anywhere on the page, relative to its edges), fixed, (positions anywhere on the screen and remains there when scrolling, relative to the screen's edges)
top, right, bottom, left used with the position property to move elements takes a measurement and moves element from the defined edge of the element, screen or page depending on the value of position

1There are properties such as border-left-width, border-bottom-style, border-right-color as well.

Putting it all together[edit]

#p-logo a { background: url( 35% 50% no-repeat !important; }
#content, #content table, #p-cactions ul li a { background: #fcfffc; }

h1 { font-family: Jokerman; font-size:28px; color:#117611; }
h2, h3, h4, h5, h6 { color: #020; }

pre { border: 1px dashed #060; }

#catlinks {
	border: 1px dotted #272;
	background-color: #fdfffd;
	padding: 4px;
#siteNotice {
	background: #fcfffc;
.usermessage {
	background: #00E400;
	border: 1.1px dashed #060;

select {
	border: 1px solid #2f6f2f; 
input {
	background-color: #fdfffd;
textarea {
	font-family: Boukman Old Style;
	font-size: 14px;

Result: Text background is a very light green. The usermessage table is redesigned to be green and have a dashed border. The logo has changed (notice after the url some specifications - these are important to have for the logo). The pre border is green. The bullet image has changed (to a green circle). The title of each page is shown in a different font and color. The rest of the headers are a dark green. The categories table has a green background, border, and some space between the text and the border. The sitenotice has the same background as the content. The select box has a green border. The input box has a light green bg. Textarea has a different font.

With the above selectors, properties, and values above, you should be able to stylize your wiki to your needs very well.

Creating your monobook.css[edit]

You have your own skin page at User:Username/monobook.css, with stress on the lower case m. When editing it, you should see some new text:

Tip: Use the 'Show preview' button to test your new CSS/JS before saving.

Whatever is entered into here is put into a style sheet (in between <style> and </style> tags). So, it is only necessary to put the list of selectors you want to change, with their properties and values, no "header" or "footer". If you want to add comments (text that the CSS won't read), put it in between /* and */. While you can preview the new CSS, some changes (like to the categories table) require you to save it first.

To see the changes after saving, hard refresh (press the F5 key, sometimes Ctrl + F5). Congratulations, you now have your own unique skin.