Extension:CSS
From MediaWiki.org
|
CSS Release status: stable |
|
|---|---|
| Implementation | Parser functions |
| Description | A parser-function for adding CSS files, article or inline rules to articles |
| Author(s) | User:Nad |
| Last Version | 1.0.4 (2008-06-01) |
| MediaWiki | 1.6.x and above |
| License | No license specified |
| Download | Download snapshot |
|
check usage (experimental) |
|
This extension allows CSS stylesheets to be included in specific articles. The CSS can be another article, a file or can be rules defined directly within the parser-function.
Contents |
[edit] Usage
For example, if you have a CSS article called "MyStyles.css", which are the styles intended for use with the article "MyFancyUserPage", you would add the following parser-function syntax to the latter,
{{#css:MyStyles.css}}
If on the other hand "MyStyles.css" was a file in the /wiki/skins directory, then it would be included as shown below. Note that the file must be an absolute path with a leading slash to distinguish it from an article title.
{{#css:/wiki/skins/MyStyles.css}}
Alternatively, CSS rules can be directly included within the parser-function (inline) as in the following example,
{{#css:
body {
background: yellow;
font-size: 20pt;
color: red;
}
}}
[edit] Installation
Download the latest snapshot and extract it to your extensions directory. Then include it in your LocalSettings.php file as in the following example.
include("$IP/extensions/CSS/CSS.php");
[edit] Bugs
See talk page
[edit] See also
- OrganicDesign:CSS example - a usage example of this extension
- Extension:PageCSS - on-page CSS styles
- Extension:AddScriptCss - a similar extension which allows stylesheets to be added from file

