More actions
Created page with "<noinclude>{{pp|small=yes}} </noinclude>{{redirect|Template:Inline list|a navbox listing templates used within lines of text to mark problems needing attention|Template:Inline cleanup tags}} {{Documentation subpage}} <!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> {{used in system|in MediaWiki:Pageinfo-header}} {{cascade-protected template}} {{tlr|startflatlist|flt}} {{Uses TemplateStyles|Template:Hlist/styles.css}} This..." |
No edit summary |
||
| (12 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{wikipedia|page name}} | |||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> | <!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> | ||
{{cascade-protected template}} | {{cascade-protected template}} | ||
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. | |||
This template provides a | |||
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. | ||
== Usage == | == Usage == | ||
| Line 17: | Line 11: | ||
{{flatlist| | {{flatlist| | ||
* | * cat | ||
* | * dog | ||
* | * horse | ||
* | * cow | ||
* | * sheep | ||
* | * pig | ||
}} | }} | ||
| Line 29: | Line 23: | ||
== Parameters == | == Parameters == | ||
{{#switch:{{NAMESPACE}}:{{ROOTPAGENAME}}|#default= | {{#switch:{{NAMESPACE}}:{{ROOTPAGENAME}}|#default= | ||
}} | }} | ||
| Line 110: | Line 40: | ||
{{flatlist| | {{flatlist| | ||
* | * cat | ||
* | * dog | ||
* | * horse | ||
* | * cow | ||
* | * sheep | ||
* | * pig | ||
}} | }} | ||
=== Alternative syntax === | === Alternative syntax === | ||
<syntaxhighlight lang="wikitext"> | <syntaxhighlight lang="wikitext"> | ||
* cat | |||
* | * dog | ||
* | * horse | ||
* | * cow | ||
* | * sheep | ||
* | * pig | ||
* | |||
</syntaxhighlight> | </syntaxhighlight> | ||
produces: | produces: | ||
* cat | |||
* | * dog | ||
* | * horse | ||
* | * cow | ||
* | * sheep | ||
* | * pig | ||
* | |||
=== Syntax for ordered lists === | === Syntax for ordered lists === | ||
<syntaxhighlight lang="wikitext"> | <syntaxhighlight lang="wikitext"> | ||
{{flatlist| | {{flatlist| | ||
# | # first | ||
# | # second | ||
# | # third | ||
# | # fourth | ||
# | # fifth | ||
# | # sixth | ||
}} | }} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 156: | Line 82: | ||
{{flatlist| | {{flatlist| | ||
# | # first | ||
# | # second | ||
# | # third | ||
# | # fourth | ||
# | # fifth | ||
# | # sixth | ||
}} | }} | ||
| Line 169: | Line 95: | ||
|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 181: | Line 107: | ||
{{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" | ||
| Line 207: | Line 133: | ||
}} | }} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| | | | ||
| <syntaxhighlight lang="html"> | | <syntaxhighlight lang="html"> | ||
<div class="hlist"> | <div class="hlist"> | ||
| Line 229: | Line 146: | ||
|} | |} | ||
<includeonly>{{Sandbox other|| | <includeonly>{{Sandbox other|| | ||
<!-- Categories below this line; interwikis at Wikidata --> | <!-- Categories below this line; interwikis at Wikidata --> | ||
Latest revision as of 04:45, 14 April 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 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
* cat
* dog
* horse
* cow
* sheep
* pigproduces:
- 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
}} |
<div class="hlist">
<ul><li>cat</li>
<li>dog</li>
<li>horse</li>
<li>cow</li>
<li>sheep</li>
<li>pig</li></ul>
</div> |