Template:Pseudoheading/sandbox
This is the template sandbox page for Template:Pseudoheading (diff). See also the companion subpage for test cases. |
This template uses TemplateStyles: |
Pseudoheading
[edit]{{Pseudoheading}} generates a classed div with an ID, as an alternative to HTML heading elements (which MediaWiki will often override the styles of); the ID can be used for anchor links. It explicitly has no support for direct CSS formatting, and applies no styles except for highlighting the text when a link to the anchor is followed. It is designed for use with classes and index-specific CSS.
Parameters
[edit]- 1: The content of the header.
- class: Optional CSS classes (use this if you have multiple heading styles in a single work). The div always has the class
.wst-heading
as well as additional classes. - id: Optional ID (used as an anchor). If not given, the contents of the header is used. This parameter should also be used to add a suitable simple ID, if markup or complex formatting is used in the header (such as a footnote directly associated with the heading). To omit the ID, set
id =
. - attr: Additional attributes.
- For example, {{pseudoheading/leveled}} uses this to set
attr = aria-level="{{{level|2}}}"
.
- For example, {{pseudoheading/leveled}} uses this to set
Examples
[edit]Example
A div with class wst-heading
and id Chapter_One
:
{{pseudoheading|Chapter One}}
Example
There are a few common styling choices you may wish to replicate.
Margin/leading underneath the heading
[edit]Example: Page:Ayn Rand Anthem.pdf/21 (using Index:Ayn Rand Anthem.pdf/styles.css)
.wst-heading {
text-align:center;
font-size:120%;
margin-bottom:1.5em;
}
Small-caps for subtitles
[edit].wst-heading {
text-align:center;
}
.wst-heading.subtitle {
font-variant:small-caps;
}
Also consider all-small-caps
if you want Proper Nouns to appear in "all small caps", including the first letters: e.g. Oxford.
Pseudoheading/inline
[edit]{{Pseudoheading/inline}} has the same behavior as {{pseudoheading}}, except that it generates a span rather than a div and adds the additional class .wst-heading-inline
.
Pseudoheading/main and Pseudoheading/subheading
[edit]{{Pseudoheading/main}} and {{pseudoheading/subheading}} call {{pseudoheading}} with the additional classes .wst-main-heading
and .wst-subheading
respectively, and produce centered text, which {{pseudoheading/main}} also makes font size 120%.
Parameters
[edit]- 1 The content of the header.
- class Optional CSS classes.
- id Optional ID.
Examples
[edit]Example
{{pseudoheading/main|Chapter I}} {{pseudoheading/subheading|Subtitle}}
Pseudoheading/leveled
[edit]{{Pseudoheading/leveled}} calls {{pseudoheading}} with the additional classes .wst-heading-leveled
and .wst-heading-leveled-{{{level}}}
.
Parameters
[edit]- 1 The content of the header.
- class Optional CSS classes. The div always has the classes
.wst-heading
,.wst-heading-leveled
and.wst-heading-leveled-{{{level}}}
as well as additional classes. - id Optional ID (used as an anchor).
- level Heading level. Typically an integer between 1 and 6, defaults to 2.
Examples
[edit]Example
{{Pseudoheading/leveled|Text}}
Example
{{Pseudoheading/leveled|Level 1|level=1}} {{Pseudoheading/leveled|Level 2|level=2}} {{Pseudoheading/leveled|Level 3|level=3}} {{Pseudoheading/leveled|Level 4|level=4}} {{Pseudoheading/leveled|Level 5|level=5}} {{Pseudoheading/leveled|Level 6|level=6}}