How would I set up individual CSS sheets for individual pages? Maybe page/css for each page, then I could add a CSS tab to all the pages?
Also, how would I go about applying a stylesheet to every page in a particular category? [[Category:X]] = stylesheet1 [[Category:Y]] = stylesheet2 [[Category:X]][[Category:Y]] = stylesheet1 & stylesheet2
So then you'd have (in order) default site/skin CSS, category CSS, page CSS, user CSS.
Bart Humphries bart.humphries@gmail.com (909)529-BART(2278)
Hi Bart,
Look at Extension:CSS. It allows one to create individual sheets for individual pages.
Another option is to use extension: NamespaceHTML. This extension allows you to use raw HTML (only use in a Namespace editable by admin) and than you can transinclude that the page designed by you (as if it was a template) into the page of your choice. Using this method you would use style tags in your HTML. This option allows a few more options since with Extension:CSS one still can't have background images.
Unfortunately no extension, I know of, operates per category. A possible solution would be to use the Page Forms extension (formerly known as Semantic Forms) and design a default form for each category. That default form could have a template with the CSS for that category (this relies on using one of the methods mentioned above).
Another option would be to use Namespaces instead of categories. Each Namespace than could use a different skin (using the extension:NamespacePerSkin) and you could further refine the CSS by setting the CSS rules in the Mediawiki:SkinName.css.
Hopefully some of the above helps.
Sent from my iPad
On Nov 3, 2016, at 7:44 PM, Bart Humphries bart.humphries@gmail.com wrote:
How would I set up individual CSS sheets for individual pages? Maybe page/css for each page, then I could add a CSS tab to all the pages?
Also, how would I go about applying a stylesheet to every page in a particular category? [[Category:X]] = stylesheet1 [[Category:Y]] = stylesheet2 [[Category:X]][[Category:Y]] = stylesheet1 & stylesheet2
So then you'd have (in order) default site/skin CSS, category CSS, page CSS, user CSS.
Bart Humphries bart.humphries@gmail.com (909)529-BART(2278) _______________________________________________ MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
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
On Tue, Nov 8, 2016 at 4:25 PM, Daniel Barrett danb@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 https://eQuality-Tech.com https://equality-tech.com/ https://freephile.org
mediawiki-l@lists.wikimedia.org