మూస:Classed heading/doc
మూస:Strong for మూస:Terminate sentence It may contain usage information, categories and other content that is not part of the original మూస page. |
This template uses Lua: |
This template uses TemplateStyles: |
Usage
[మార్చు]This generates a HTML heading element for use in applying semantically-correct headings to works when == Equals syntax ==
is insufficient (perhaps because you want to apply a class, or have multiple lines).
It explicitly has no support for direct CSS formatting: it is designed for use with classes and/or index-specific CSS.
By default, the headings have the normal MediaWiki font sizes for headings, but are centred, not bolded and do not have an underline.
- level The heading level (default: 2)
- class Optional CSS classes (use this if you have multiple heading styles in a single work). The top-level heading element always has class
.wst-heading
as well as additional classes. - id Optional ID (used as an anchor). If not given the contents of the first line is used. This parameter should also be used to add an suitable simple id, if markup or complex formatting is used in the first line (such as a footnote directly associated with the heading.)
- 1, 2, etc. The lines of the header. Each line is in a span under the default span with class
.wst-heading-line
and can be targeted with:nth-child
as needed.
Example
{{classed heading|l=2|Line 1|Line 2}} {{lorem ipsum}}
Line 1Line 2
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Example
{{classed heading|l=3|Line 1|Line 2}} {{lorem ipsum}}
Line 1Line 2
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Common CSS examples
[మార్చు]There are a few common styling choices you may wish to replicate. You can target specific levels using the hN
tag names.
Margin/leading underneath the heading
[మార్చు]Example: Page:Ayn Rand Anthem.pdf/21 (using Index:Ayn Rand Anthem.pdf/styles.css)
h3 .wst-heading-line {
margin-bottom: 1.5em;
}
Small-caps for the second line onwards
[మార్చు]h3 .wst-heading-line:nth-child(n+2) {
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.
Left-aligned titles
[మార్చు]Example: Page:The Sundering Flood - Morris - 1898.djvu/15 (using Index:The Sundering Flood - Morris - 1898.djvu/styles.css)
h3 .wst-heading {
text-align: left;
}
See also
[మార్చు]- {{heading}} if you need to use direct inline CSS formatting rather than via classes
Template data
[మార్చు]TemplateData for Classed heading
Add an HTML header with optional classes
పరామితి | వివరణ | రకం | స్థితి | |
---|---|---|---|---|
level | level l | The level of the heading (1 is the "biggest" heading)
| సంఖ్య | సూచించినవి |
1 | 1 | First line of heading
| లైను | తప్పనిసరి |
2 | 2 | Second line of the heading
| లైను | ఐచ్చికం |
class | class | Optional class to use to target specific CSS
| లైను | ఐచ్చికం |
id | id | ID of the header - can be used for linking to sections
| తెలియనిది | ఐచ్చికం |