开发者

Is there an easy way to give a MediaWiki wiki page a specific background colour?

We're looking to give pages in a specific category a s开发者_如何学运维pecific background colour. Since every page in this category makes use of a specific template, we're ideally looking for a template change.

Can this be done?


Use the PageCSS extension, you should be able to put the css in your template, which would then apply to the pages it is on.

example:

 <css>
  #bodyContent { background-color: yellow; }
 </css>


For the MediaWiki 1.18, you only need CSS and this code:

{{#css:
    #bodyContent { background-color: yellow; }
  body {
    background: navajowhite;
  }
}}

This will give the part of the page with text a yellow colour and the rest (border) a brown-ish colour.

For best results, put this in a template, e.g. {{Page colour}}, so that it can be called with, e.g. {{Page color|red|yellow}}. The template code will then be:

{{#css:
    #bodyContent { background-color: {{{1|yellow}}}; }<!-- Page color -->
  body {
    background: {{{2|navajowhite}}};<!-- Border color -->
  }
}}

where 1 & 2 are parameters (page and border respectively) with default colours (yellow and brownish).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜