Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Flatlist/doc: Difference between revisions

Template page
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 [[Web Content Accessibility Guidelines|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 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]]
* cat
* [[dog]]
* dog
* [[horse]]
* horse
* [[cow]]
* cow
* [[sheep]]
* sheep
* [[pig]]
* pig
}}
}}


Line 111: Line 111:


{{flatlist|
{{flatlist|
* [[cat]]
* cat
* [[dog]]
* dog
* [[horse]]
* horse
* [[cow]]
* cow
* [[sheep]]
* sheep
* [[pig]]
* pig
}}
}}


Line 122: Line 122:
<syntaxhighlight lang="wikitext">
<syntaxhighlight lang="wikitext">
{{startflatlist}}
{{startflatlist}}
* [[cat]]
* cat
* [[dog]]
* dog
* [[horse]]
* horse
* [[cow]]
* cow
* [[sheep]]
* sheep
* [[pig]]
* pig
{{endflatlist}}
{{endflatlist}}
</syntaxhighlight>
</syntaxhighlight>
Line 134: Line 134:


{{startflatlist}}
{{startflatlist}}
* [[cat]]
* cat
* [[dog]]
* dog
* [[horse]]
* horse
* [[cow]]
* cow
* [[sheep]]
* sheep
* [[pig]]
* pig
{{endflatlist}}
{{endflatlist}}


Line 145: Line 145:
<syntaxhighlight lang="wikitext">
<syntaxhighlight lang="wikitext">
{{flatlist|
{{flatlist|
# [[first]]
# first
# [[second]]
# second
# [[3|third]]
# third
# [[fourth]]
# fourth
# [[fifth]]
# fifth
# [[sixth]]
# sixth
}}
}}
</syntaxhighlight>
</syntaxhighlight>
Line 157: Line 157:


{{flatlist|
{{flatlist|
# [[first]]
# first
# [[second]]
# second
# [[3|third]]
# third
# [[fourth]]
# fourth
# [[fifth]]
# fifth
# [[sixth]]
# 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 1936 Winter Olympics
* [[Alpine skiing at the 1948 Winter Olympics]]
* Alpine skiing at the 1948 Winter Olympics
* [[Alpine skiing at the 1952 Winter Olympics]]
* Alpine skiing at the 1952 Winter Olympics
* [[Alpine skiing at the 1956 Winter Olympics]]
* Alpine skiing at the 1956 Winter Olympics
* [[Alpine skiing at the 1960 Winter Olympics]]
* Alpine skiing at the 1960 Winter Olympics
* [[Alpine skiing at the 1964 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 1936 Winter Olympics
* [[Alpine skiing at the 1948 Winter Olympics]]
* Alpine skiing at the 1948 Winter Olympics
* [[Alpine skiing at the 1952 Winter Olympics]]
* Alpine skiing at the 1952 Winter Olympics
* [[Alpine skiing at the 1956 Winter Olympics]]
* Alpine skiing at the 1956 Winter Olympics
* [[Alpine skiing at the 1960 Winter Olympics]]
* Alpine skiing at the 1960 Winter Olympics
* [[Alpine skiing at the 1964 Winter Olympics]]
* Alpine skiing at the 1964 Winter Olympics
}}
}}


== Technical details ==
== Technical details ==
This template uses the <code>.hlist</code> [[Cascading Style Sheets|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 [[interpunct]]s between list items and parentheses around nested lists.
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).

Template:Pp Template:Redirect

Template:Used in system

Template:Tlr

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.

Template:TOC limit

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

Template:Format TemplateData

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:

Template:Startflatlist

  • cat
  • dog
  • horse
  • cow
  • sheep
  • pig

Syntax for ordered lists

{{flatlist|
# first
# second
# third
# fourth
# fifth
# sixth
}}

produces:

  1. first
  2. second
  3. third
  4. fourth
  5. fifth
  6. 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:

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

Template:HTML lists