Difference between revisions of "Template:Flatlist/doc"

From blackwiki
Jump to navigation Jump to search
imported>Sardanaphalus
(link)
imported>Pigsonthewing
(ce)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{TOClimit|3}}
+
{{TOClimit|3
 +
 
 +
This template provides a [[Web Content Accessibility Guidelines|WCAG]]/ISO-standards-compliant accessible alternative to <code><nowiki><br /></nowiki></code> separated lists, per [[WP:FLATLIST]] and [[WP:HLIST]].
 +
 
 +
==Usage==
  
===Usage===
 
 
{{tl|flatlist}} starts a horizontal list, such as:
 
{{tl|flatlist}} starts a horizontal list, such as:
 +
 
{{flatlist}}
 
{{flatlist}}
 
* [[cat]]
 
* [[cat]]
Line 13: Line 17:
 
* [[pig]]
 
* [[pig]]
 
{{endflatlist}}
 
{{endflatlist}}
 +
 
The bottom margin is inherited from the current container. Normally this will be 0.5[[Em (typography)|em]]. This template can be used with or without {{tl|endflatlist}}.
 
The bottom margin is inherited from the current container. Normally this will be 0.5[[Em (typography)|em]]. This template can be used with or without {{tl|endflatlist}}.
  
Line 19: Line 24:
 
For image captions, * (i.e. asterisk) markup does not work, so consider using {{tl|hlist}} instead.
 
For image captions, * (i.e. asterisk) markup does not work, so consider using {{tl|hlist}} instead.
  
===Examples===
+
==Examples==
 +
 
 
<div style="padding-bottom:1.0em;">
 
<div style="padding-bottom:1.0em;">
 +
 
<pre>
 
<pre>
 
{{flatlist|
 
{{flatlist|
Line 31: Line 38:
 
}}
 
}}
 
</pre>
 
</pre>
 +
 
produces:
 
produces:
 +
 
{{flatlist|
 
{{flatlist|
 
* [[cat]]
 
* [[cat]]
Line 42: Line 51:
 
</div>
 
</div>
  
====Alternative syntax====
+
===Alternative syntax===
 +
 
 
<div style="padding-bottom:1.0em;">
 
<div style="padding-bottom:1.0em;">
 
<pre>
 
<pre>
Line 54: Line 64:
 
{{endflatlist}}
 
{{endflatlist}}
 
</pre>
 
</pre>
 +
 
produces:
 
produces:
 +
 
{{flatlist}}
 
{{flatlist}}
 
* [[cat]]
 
* [[cat]]
Line 65: Line 77:
 
</div>
 
</div>
  
====Syntax for ordered lists====
+
===Syntax for ordered lists===
 +
 
 
<div style="padding-bottom:1.0em;">
 
<div style="padding-bottom:1.0em;">
 
<pre>
 
<pre>
Line 77: Line 90:
 
{{endflatlist}}
 
{{endflatlist}}
 
</pre>
 
</pre>
 +
 
produces:
 
produces:
 +
 
{{startflatlist}}
 
{{startflatlist}}
 
# [[first]]
 
# [[first]]
Line 88: Line 103:
 
</div>
 
</div>
  
===Parameters===
+
==Parameters==
 +
 
 
* '''''class''''' adds a CSS class to the containing div. Use <tt>nowraplinks</tt> to prevent links from wrapping.
 
* '''''class''''' adds a CSS class to the containing div. Use <tt>nowraplinks</tt> to prevent links from wrapping.
 
* '''''style''''' adds CSS styling. Complex styles should not be used in articles (per [[WP:Deviations]]) but may be acceptable on user, project and talk pages.
 
* '''''style''''' adds CSS styling. Complex styles should not be used in articles (per [[WP:Deviations]]) but may be acceptable on user, project and talk pages.
Line 95: Line 111:
 
::Example: {{para|<var>indent</var>|<var>2</var>}}
 
::Example: {{para|<var>indent</var>|<var>2</var>}}
  
===Technical details===
+
==Technical details==
 +
 
 
This template uses the <code>.hlist</code> CSS class defined in 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. Some of the CSS used is not compatible with all browsers, notably Internet Explorer 6 and 7. In these cases, JavaScript in Common.js generates the interpuncts and parentheses.
 
This template uses the <code>.hlist</code> CSS class defined in 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. Some of the CSS used is not compatible with all browsers, notably Internet Explorer 6 and 7. In these cases, JavaScript in Common.js generates the interpuncts and parentheses.
  
===See also===
+
==See also==
 +
 
 
* {{tl|startflatlist}} and {{tl|endflatlist}}
 
* {{tl|startflatlist}} and {{tl|endflatlist}}
 
* {{tl|hlist}}
 
* {{tl|hlist}}

Revision as of 20:37, 16 April 2014

{{TOClimit|3

This template provides a WCAG/ISO-standards-compliant accessible alternative to <br /> separated lists, per WP:FLATLIST and WP:HLIST.

Usage

{{flatlist}} starts a horizontal list, such as:

The bottom margin is inherited from the current container. Normally this will be 0.5em. This template can be used with or without {{endflatlist}}.

For navigation boxes using {{navbox}}, one can set |listclass=hlist, and achieve the same styling without using this template.

For image captions, * (i.e. asterisk) markup does not work, so consider using {{hlist}} instead.

Examples

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

produces:

Alternative syntax

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

produces:

Syntax for ordered lists

{{startflatlist}}
# [[first]]
# [[second]]
# [[third]]
# [[fourth]]
# [[fifth]]
# [[sixth]]
{{endflatlist}}

produces:

Template:Startflatlist

  1. first
  2. second
  3. third
  4. fourth
  5. fifth
  6. sixth

Parameters

  • class adds a CSS class to the containing div. Use nowraplinks to prevent links from wrapping.
  • style adds CSS styling. Complex styles should not be used in articles (per WP:Deviations) but may be acceptable on user, project and talk pages.
Example: |style=border:solid 1px silver; background:lightyellow
  • indent indents the list by a number of standard indents, one indent being 1.6em. (Useful in an indented discussion thread.)
Example: |indent=2

Technical details

This template uses the .hlist CSS class defined in 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. Some of the CSS used is not compatible with all browsers, notably Internet Explorer 6 and 7. In these cases, JavaScript in Common.js generates the interpuncts and parentheses.

See also