Help:Cascading style sheets

Cascading Style Sheets is a style sheet language used to describe the appearance of the page. It allows for flexible formatting of a page and should be used instead of tables whenever possible, because they can be manipulated by the reader or overridden by an author if your css is embedded in another page via a template.

Style may be specified inline for a each HTML elements or pieces of content, see e.g. color; scope of parameters. Alternatively, style is specified for CSS selectors located in special files called 'stylesheets' and expressed in terms of elements, classes, id's and other attributes. This is done on various levels:

user-specific per skin: User:username/skinname.css (note that in the CSS terminology user-specific style sheets are not user stylesheets)

User stylesheet:

web-wide, user-specific: local file, referred to in the browser settings, or directly set in the browser

A HTML element may be just taken from the wikitext (see HTML in wikitext), e.g. , or the result of parsing wikitext – for instance, the ''' code is changed into <b>. A HTML element can also be taken from the code for the used skin.

A 'class' may be produced by the software, e.g. ns-namespace number for the HTML-element "body", and extiw for an interwiki link in the page body, or taken from the wikitext.

Similarly an 'id' may be produced by the software, e.g. bodyContent, or taken from the wikitext.

In the case of conflicting style settings for a piece of content, the resulting setting depends primarily on the indication "!important". Secondarily, if both are important, the user wins, if neither is, the author wins. Tertiarily it depends on specificity. Only lastly it depends on order between and within stylesheets: the last wins. Thus a User:username/monobook.css does not win from MediaWiki:Monobook.css (both author, not user) if the specificity of the latter is greater. See also cascading order.

You may wish to use styles that are already predefined by MediaWiki, or the site that you are visiting. This can be done by assigning predefined classes to html tags in the wikitext. You can also create a style that is unique to your page.

Try inspecting the page with the Developer tools probably provided with your browser to find the hidden element.

If would like to view the hidden text you could use an add-on for your browser. For example the Web Developer add-on is available for Firefox and Chrome. You could add it to your browser and then choose Misc. -> Display Hidden Elements in that toolbar, to make all hidden elements appear.

A class or id can depend on the result produced by a template or on a template parameter, e.g. class="abc{{{1|def}}}". For one or more of the possible class names the style of that class can be defined. If the class is undefined it is ignored, so the standard style is used.

In the simplest case we have e.g. class="abc{{{1}}}" and define class abcdef. If the parameter value is "def" it applies.

If a page for general use only makes sense when styles are defined for certain classes, then these have to be specified in the page MediaWiki:Common.css, which applies for all users and all skins, as far as not overridden.

displays "Wed" if parameter 3 is defined, but its value is not "none", and displays nothing if parameter 3 is undefined or "none". If the value of parameter 3 is a display style other than "none", that style is applied.