Extension:CSS/ja

CSS拡張機能は、特別な文章に対し、CSSスタイルシートによる表示を行えるようにするものです. CSSは、構文解析機能により、直接定義された法則、または他の記事やファイルともなりえます.

使用法
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,

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.

Alternatively, CSS rules can be directly included within the parser-function (inline) as in the following example,

設定
Optionally, you can set the base URL for external files.

PageCSSの代替として使用する
There is a prior (now archived) which used  and  tags instead of the #css: parser function. This extension can do most of what those extensions provide, but the syntax is incompatible. One way to avoid breaking existing pages which still use the old tags is to use both this Extension:CSS and  on the same wiki.

An alternate solution (if you want to use only this extension, but have existing content which expects Extension:PageCSS) is to save this stub function as a PHP file and include it from your LocalSettings.php to remap &lt;css> to #css:

At this point, the prior PageCSS (or NewPageCSS) extensions may be removed from your configuration; &lt;css> now goes to #css: and (if you have this CSS extension already up and running) will behave the way any of the other CSS extensions always have.

Problems with changing the color or background of a specific page
Using the parser function to use the CSS from another page does not work to change the color or background of the page, however, using the parser function on a single page by itself does allow the background to be changed. To overcome this problem, it is possible to load the CSS through transclusion, which does not cause the problem of failing to load the change to the page background.

バグ
トークページを参照してください.

関連項目

 * - CSSをサニタイズして別のページに保存する似たような拡張機能です.
 * - CSSをサニタイズして別のページに保存する似たような拡張機能です.