More actions
No edit summary |
No edit summary |
||
| Line 8: | Line 8: | ||
{{tlr|startflatlist|flt}} | {{tlr|startflatlist|flt}} | ||
{{Uses TemplateStyles|Template:Hlist/styles.css}} | {{Uses TemplateStyles|Template:Hlist/styles.css}} | ||
This template provides a | This template provides a WCAG/ISO-standards-compliant accessible alternative to comma- or dash- (or other single character-) separated lists, per [[WP:FLATLIST]] and [[MOS:HLIST]]. | ||
Lists output by {{tl|Flatlist}} and {{tl|Hlist}} are semantically and visually identical, and differ only in the wiki-markup used to create the lists. | Lists output by {{tl|Flatlist}} and {{tl|Hlist}} are semantically and visually identical, and differ only in the wiki-markup used to create the lists. | ||
| Line 18: | Line 18: | ||
{{flatlist| | {{flatlist| | ||
* | * cat | ||
* | * dog | ||
* | * horse | ||
* | * cow | ||
* | * sheep | ||
* | * pig | ||
}} | }} | ||
| Line 111: | Line 111: | ||
{{flatlist| | {{flatlist| | ||
* | * cat | ||
* | * dog | ||
* | * horse | ||
* | * cow | ||
* | * sheep | ||
* | * pig | ||
}} | }} | ||
| Line 122: | Line 122: | ||
<syntaxhighlight lang="wikitext"> | <syntaxhighlight lang="wikitext"> | ||
{{startflatlist}} | {{startflatlist}} | ||
* | * cat | ||
* | * dog | ||
* | * horse | ||
* | * cow | ||
* | * sheep | ||
* | * pig | ||
{{endflatlist}} | {{endflatlist}} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 134: | Line 134: | ||
{{startflatlist}} | {{startflatlist}} | ||
* | * cat | ||
* | * dog | ||
* | * horse | ||
* | * cow | ||
* | * sheep | ||
* | * pig | ||
{{endflatlist}} | {{endflatlist}} | ||
| Line 145: | Line 145: | ||
<syntaxhighlight lang="wikitext"> | <syntaxhighlight lang="wikitext"> | ||
{{flatlist| | {{flatlist| | ||
# | # first | ||
# | # second | ||
# | # third | ||
# | # fourth | ||
# | # fifth | ||
# | # sixth | ||
}} | }} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 157: | Line 157: | ||
{{flatlist| | {{flatlist| | ||
# | # first | ||
# | # second | ||
# | # third | ||
# | # fourth | ||
# | # fifth | ||
# | # sixth | ||
}} | }} | ||
| Line 170: | Line 170: | ||
|style=border:solid 1px silver; background:lightyellow; | |style=border:solid 1px silver; background:lightyellow; | ||
|class=nowraplinks | | |class=nowraplinks | | ||
* | * Alpine skiing at the 1936 Winter Olympics | ||
* | * Alpine skiing at the 1948 Winter Olympics | ||
* | * Alpine skiing at the 1952 Winter Olympics | ||
* | * Alpine skiing at the 1956 Winter Olympics | ||
* | * Alpine skiing at the 1960 Winter Olympics | ||
* | * Alpine skiing at the 1964 Winter Olympics | ||
}} | }} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 182: | Line 182: | ||
{{flatlist |indent=2 |style=border:solid 1px silver; background:lightyellow; |class=nowraplinks | | {{flatlist |indent=2 |style=border:solid 1px silver; background:lightyellow; |class=nowraplinks | | ||
* | * Alpine skiing at the 1936 Winter Olympics | ||
* | * Alpine skiing at the 1948 Winter Olympics | ||
* | * Alpine skiing at the 1952 Winter Olympics | ||
* | * Alpine skiing at the 1956 Winter Olympics | ||
* | * Alpine skiing at the 1960 Winter Olympics | ||
* | * Alpine skiing at the 1964 Winter Olympics | ||
}} | }} | ||
== Technical details == | == Technical details == | ||
This template uses the <code>.hlist</code> | This template uses the <code>.hlist</code> CSS class defined in [[MediaWiki:Common.css]] to generate horizontal lists. It causes ordinary html list items to be displayed inline (horizontally), where they would normally display as block elements (vertically). The class also generates the interpuncts between list items and parentheses around nested lists. | ||
{| class="wikitable" | {| class="wikitable" | ||
Revision as of 20:12, 29 March 2025
| This page uses Creative Commons Licensed content from Wikipedia (view authors). |
| This is a documentation subpage for Template:Flatlist It may contain usage information, categories and other content that is not part of the original template page. |
| This template can only be edited by administrators because it is transcluded onto one or more cascade-protected pages. |
| This template uses TemplateStyles: |
This template provides a WCAG/ISO-standards-compliant accessible alternative to comma- or dash- (or other single character-) separated lists, per WP:FLATLIST and MOS:HLIST.
Lists output by {{Flatlist}} and {{Hlist}} are semantically and visually identical, and differ only in the wiki-markup used to create the lists.
Usage
{{flatlist}} starts a horizontal list, such as:
- cat
- dog
- horse
- cow
- sheep
- pig
If this template is used with no parameters, {{endflatlist}} is required. For navigation boxes using {{navbox}}, one can set |listclass=hlist, and achieve the same styling without using this template. For image captions, list (i.e. asterisk) markup does not work, so consider using {{hlist}} instead.
Parameters
Examples
{{flatlist|
* [[cat]]
* [[dog]]
* [[horse]]
* [[cow]]
* [[sheep]]
* [[pig]]
}}produces:
- cat
- dog
- horse
- cow
- sheep
- pig
Alternative syntax
{{startflatlist}}
* cat
* dog
* horse
* cow
* sheep
* pig
{{endflatlist}}produces:
- cat
- dog
- horse
- cow
- sheep
- pig
Syntax for ordered lists
{{flatlist|
# first
# second
# third
# fourth
# fifth
# sixth
}}produces:
- first
- second
- third
- fourth
- fifth
- sixth
Using optional parameters
{{flatlist |indent=2
|style=border:solid 1px silver; background:lightyellow;
|class=nowraplinks |
* Alpine skiing at the 1936 Winter Olympics
* Alpine skiing at the 1948 Winter Olympics
* Alpine skiing at the 1952 Winter Olympics
* Alpine skiing at the 1956 Winter Olympics
* Alpine skiing at the 1960 Winter Olympics
* Alpine skiing at the 1964 Winter Olympics
}}produces:
- Alpine skiing at the 1936 Winter Olympics
- Alpine skiing at the 1948 Winter Olympics
- Alpine skiing at the 1952 Winter Olympics
- Alpine skiing at the 1956 Winter Olympics
- Alpine skiing at the 1960 Winter Olympics
- Alpine skiing at the 1964 Winter Olympics
Technical details
This template uses the .hlist CSS class defined in MediaWiki:Common.css to generate horizontal lists. It causes ordinary html list items to be displayed inline (horizontally), where they would normally display as block elements (vertically). The class also generates the interpuncts between list items and parentheses around nested lists.
| Wikitext | Expanded template | HTML |
|---|---|---|
{{flatlist|
* cat
* dog
* horse
* cow
* sheep
* pig
}} |
Template:Nowiki2 | <div class="hlist">
<ul><li>cat</li>
<li>dog</li>
<li>horse</li>
<li>cow</li>
<li>sheep</li>
<li>pig</li></ul>
</div> |
See also
- {{endflatlist}}
- {{hlist}}
- {{plainlist}} and {{unbulleted list}}
- {{bulleted list}}
- {{ordered list}}
- {{nowrap}}
- {{pagelist}}
- WP:HLIST