| advertise add site services publishers database health videos | ![]() | about toolbar stats live show health store more stuff JOIN/LOGIN |
Cascading Style Sheet 1 faslink.org | Style Sheet kriegereye.org | JMS plastics, white plastic sheets, insole grinder, acrylic plastic... jmsplastics.com | Slide Sheets, Glide Sheets, Transfer Sheets and Transfer Slides handyhealthcare.co.uk |
Cascading Style Sheets allow for flexible formatting of a page. They 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.
[edit] Levels of CSS settingsStyle may be specified specifically for a piece of content, see e.g. color; scope of parameters Alternatively, style is specified for CSS selectors, expressed in terms of elements, classes and id's. This is done on various levels: Author stylesheets, in this order:
User stylesheet:
A HTML element may be just taken from the wikitext (see HTML in wikitext), e.g. span, or the result of translating wikitext, e.g. the 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 cascade. [edit] Supported ElementsMediawiki supports most CSS, with such exceptions as the url() attribute. There were some bugs in css support in earlier versions. Further information: the CSS specification . [edit] CSS in wikitextYou can use CSS styling in HTML elements in your code (see Help:HTML in wikitext for a list of elements supported by MediaWiki) like you would in normal HTML markup. For example, a "div" element with a green border and its contents floated to the right would be created with <div style="float:right; border:thin solid green;"> Here comes a short paragraph that is<br /> contained in a "div" element that is<br /> floated to the right.</div> Here comes a short paragraph that is which would produce the box to the right. {| style="your style here" |- |your table stuff |- |} Further information: Help:Tables [edit] Mediawiki existing stylesYou may wish to use a style type that is already predefined by mediawiki, or the site that you are visiting. You can also create a style that is unique to your page. Monobook is the default style, you can view it at: http://en.wikipedia.org/skins-1.5/monobook/main.css You will give your css tag an existing "class" Please put a list of existing classes here. [edit] Tips and tricks[edit] Non-displayIn an embedded page, one can hide comments in one version, and show them in another view. One extreme "style" for a text is not displaying it, with .classname {display: none} #id {display: none} etc. Non-displayed links do not work (as opposed to links in a very small font). It cannot be used to remove text in expressions for template names, parameter names, parameter values, page names in links, etc. To view hidden text, download the Web Developer Toolbar for Firefox here, then choose Misc. -> show hidden elements in that toolbar. It will make all hidden elements appear. [edit] Non-printOne can exclude content from being printed (if the browser supports CSS) by declaring the content to be of the "noprint" class: <div class="someclass noprint">This will not appear in the print version.</div> [edit] Major style blocks
The portlet class is the style used by all the div blocks around the main content. Identified blocks using that class:
The footer at the bottom of the page includes blocks with the following ids
[edit] Style depending on a parameter or variable[edit] Variable class or idA 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. [edit] Variable style parameter valueWikitext like <span style="display:{{{3|none}}}">Wed</span> 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. [edit] See also
[edit] Wikipedia-specific helpPlease see Wikipedia:Catalogue of CSS classes and classes used in microformats |
| ↑ top of page ↑ | about thumbshots |