On Tue, Nov 8, 2016 at 4:25 PM, Daniel Barrett <danb(a)cimpress.com> wrote:
Bart Humphries asked:
How would I set up individual CSS sheets for
individual pages?
There are wiki extensions on
mediawiki.org for adding CSS. See
https://www.mediawiki.org/wiki/Category:CSS
If you just need to change a few important pages, like the home page, you
don't need an extension. Start by looking at the <body> tag of the page in
question. For example, a page named "Foo" would have this body tag:
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-Foo
rootpage-Foo skin-vector action-view">
Now in MediaWiki:Common.css or MediaWiki:Vector.css, you can limit changes
just to the page "Foo":
body.page-Foo {
font-size: 16px;
}
Also, how would I go about applying a stylesheet
to every page in a
particular category?
I can't think of an easy way to do this in MediaWiki core, because the
page source doesn't indicate which categories a page is in (except by
presence of category links). You'd probably have to create JavaScript for
this purpose in MediaWiki:Common.js (or similar). On the other hand, it's
easy to apply CSS to a particular namespace. For example, the Category
namespace (ID = 14) can have a different background color for its pages,
like this:
body.ns-14 #content {
background-color: #F8FCFF;
}
Hope this helps,
DanB
Nice tips Dan. I like the page selector and namespace rules. Drupal has a
similar theming approach. Helps me.
~ Greg
Greg Rundlett