Manual:CSS


 * Did you mean: Extension:CSS?

Cascading style sheet (CSS) markup sets much of the look and feel of MediaWiki -- font size, colors, spacing, the logo and background image, even whether stuff is displayed or is hidden.

CSS can be used to change the style of the entire wiki, for example to make the background a different colour, or you can use inline css to style specific pieces of text in your wiki. For example green text can be accomplished by doing. If you want to make all text on the wiki green you can add the code  to mediawiki:Common.css.

To change the look and feel of MediaWiki's monitor and projector display (how it looks in a browser window) you can put CSS into MediaWiki:Common.css.

To change the way MediaWiki pages print, you put CSS into MediaWiki:Print.css on your wiki.

If enabled on your wiki, individual users can create custom stylesheets just for themselves at special:mypage/.css (for example special:mypage/vector.css if they are using the vector skin). special:mypage/common.css allows the creation of personal stylesheets for all skins.

You can also create custom skins for MediaWiki.

Help
CSS syntax, attributes and values, must be correct or stuff won't work right. W3C.org is an excellent reference for checking how to write CSS correctly directly from the standards:
 * http://www.w3.org/TR/CSS21/propidx.html -- CSS 2.1 Index of properties &larr; very helpful
 * http://www.w3.org/TR/CSS21/indexlist.html -- CSS 2.1 Index of everything
 * http://www.w3.org/TR/CSS21/cover.html#minitoc -- CSS 2.1 Table of Contents

Wikipedia provides a good overview of CSS, along with links to additional supporting resources.

If you do not want to read through the pages and pages of standard design and deployments, then reading from the W3 Schools explanation of features, derived from the W3C standards, will provide you a quick-reference guide to syntax and basic usage of the various elements. The site will provide reference to past versions but for the most point is an "up-to-date" reference guide.


 * W3Schools CSS Reference

Caveats
Be sure to keep your markup semantic. Relying on styling to indicate meaning is a bad practice (e.g. for machine readability such as by search engines, screen readers using text-to-speech, and text browsers).

Normalized CSS
Much CSS today relies on a "reset" or "normalize" CSS to make all browsers work the same. MediaWiki does not have a reset per se, though there is Common.css.

If you copy CSS, watch if it depends on additional CSS. For example jsfiddle's normalized CSS sets margins to 0 and resets the numbers on ordered lists.

jsfiddle has a feature to import CSS. If you're testing against the Vector skin, the primary sheets should be (in this order):


 * General CSS built in to core
 * Vector CSS built-in to core
 * Site CSS (MediaWiki namespace)

This should give you a better idea how your CSS interacts with the CSS on WMF wikis.