Jump to content

Help:Extension:ProofreadPage/Index-specific CSS

From mediawiki.org

Every ProofreadPage Index page can have a CSS stylesheet added (as long as Extension:TemplateStyles is installed). This CSS stylesheet is applied to every page in the Page namespace, and also to Page pages that are transcluded with the <pages/> tag .

Creating the stylesheet

[edit]

To create an Index stylesheet, all you need to do is add a styles.css subpage. For example, create Index:Foobar.djvu/styles.css. This will be automatically applied to all Page-namespace pages in that Index.

Targeting elements

[edit]

The ability to target specific element on a page depends on the wiki, as these are usually added in templates. Generally, elements are targeted by classes:

.wst-red {
    color: red;
}

It is suggested that classes added by templates use a common prefix (e.g. English Wikisource uses wst-) to make it obvious that a certain class originates in a template.

Using an underscore as a prefix for work-specific classes also makes is less likely that this Index-specific CSS will collide with built-in MediaWiki CSS.

Permitted CSS

[edit]

The CSS used is a subset of CSS called sanitized-css. Some features are not used, for example data URLs and some browser-prefixed or non-standard CSS properties.

For full details, see the TemplateStyles documentation .

Legacy 'CSS' field

[edit]

Index pages can have a field called CSS (configured in MediaWiki:Proofreadpage index data config.json; the field name is not case sensitive), but use of this is no longer recommended. This field would load any CSS entered there on every Page page of the Index, but not on any transclusions.

Any styles added with a CSS field should be migrated to an Index-specific subpage, or more general TemplateStyles where appropriate.

See also

[edit]