Content deleted Content added
No edit summary Tags: Reverted Visual edit Mobile edit Mobile web edit |
Reverting edit(s) by 102.45.18.254 (talk) to rev. 1297657178 by Annh07: Unexplained content removal (UV 0.1.6) |
||
(42 intermediate revisions by 26 users not shown) | |||
Line 1:
{{Information page|H:CSS|WP:CSS}}
[[Cascading Style Sheets]] allows for flexible formatting of a page. They should be used instead of [[Help:Table|tables]] for non-tabular content whenever possible, because they can be [[Help:User style|manipulated by the reader]] or overridden by an author if your CSS is embedded in another page via a [[Help:Template|template]].
== Levels of CSS settings ==
Line 51 ⟶ 52:
* User-specific web-wide browser settings: local file referred to in the browser settings, or directly set in the browser
Note that in CSS terminology, the user-specific style sheets are ''not'' [[Help:User style|user style sheets]].
===Usage===
An HTML element may be just taken from the wikitext (see [[Help:HTML in wikitext|HTML in wikitext]]), e.g., span, or the result of translating wikitext, e.g., the <code><nowiki>'''...'''</nowiki></code> code is changed into
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.
Line 72 ⟶ 73:
You 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
<syntaxhighlight lang="html">
<div style="float:right; border:thin solid green;">
Line 88 ⟶ 89:
Some wikitext elements allow you to insert CSS styling directly into them. An example is the table syntax:
{{-}}
<syntaxhighlight lang="wikitext">
{| style="your style here"
|-
|your table stuff
|}
</syntaxhighlight>
{{Further2|[[Help:Tables]]}}
Line 112 ⟶ 113:
One extreme "style" for a text is not displaying it, with
<syntaxhighlight lang="css">
.''classname'' {display: none}▼
</syntaxhighlight>
etc.
Line 121 ⟶ 124:
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 [https://addons.mozilla.org/en-US/firefox/addon/60 here], then choose Misc.
=== Non-print ===
One can exclude content from being printed
<syntaxhighlight lang="html">
<div class="someclass noprint">This will not appear in the print version.</div>
</syntaxhighlight>
== Major style blocks ==
Line 155 ⟶ 158:
=== Variable class or id ===
A class or id can depend on the result produced by a template or on a template parameter, e.g. <syntaxhighlight lang="wikitext" inline>class="abc
In the simplest case we have e.g. <syntaxhighlight lang="wikitext" inline>class="abc
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.
Line 164 ⟶ 167:
Wikitext that reads
will display "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.
|