Template:Flatlist

From Wikidata
Jump to navigation Jump to search
Documentation icon Template documentation[view · edit · history · purge ]


Usage[edit]

{{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.

Examples[edit]

Template:Flatlist examples
Unordered lists Ordered lists
Standard syntax Alternative syntax
Wikitext {{Flatlist| * {{LinkedLabel|Q1}} * {{LinkedLabel|Q3}} * {{LinkedLabel|Q4}} * {{LinkedLabel|Q5}} * {{LinkedLabel|Q8}} * {{LinkedLabel|Q19}} }} {{Flatlist}} * {{LinkedLabel|Q15}} * {{LinkedLabel|Q51}} * {{LinkedLabel|Q48}} * {{LinkedLabel|Q46}} * {{LinkedLabel|Q49}} * {{LinkedLabel|Q18}} {{Endflatlist}} {{Flatlist|class=hnum| # {{LinkedLabel|Q308}} # {{LinkedLabel|Q313}} # {{LinkedLabel|Q2}} # {{LinkedLabel|Q111}} # {{LinkedLabel|Q319}} # {{LinkedLabel|Q193}} }}
Output

Parameters[edit]

Template:Flatlist parameters
Name Function
class Adds a CSS class to the <div> wrapper tags; passing |class=hnum will cause ordered lists to have numbers, whereas |class=hwrap allows list items to be wrapped.
style Adds CSS style declarations to the list tags (<ol> or <ul>); complex styles should not be used in articles (per English Wikipedia's MOS:DEVIATIONS) but may be acceptable in the User, Project and Talk namespaces.
    Example: |style=background: LightYellow; border: 1px solid Silver;
indent Indents the list by a number of standard indents (one indent being 1.6em), particularly handy for inclusion in an indented discussion thread.
    Example: |indent=2

Technical details[edit]

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 some older browsers, notably Internet Explorer 6 and 7. In these cases, JavaScript in Common.js generates the interpuncts and parentheses.

Bugs[edit]

There is one situation where the .hlist class will fail in one or more browsers:

  • When a horizontal list, built using wiki markup, is displayed on pages in the Special namespace (where it may be transcluded from MediaWiki: pages), horizontal lists will not wrap to the next line. This is due to HTML Tidy not being active on these pages. This may be fixed in the future (Bugzilla:39617). As a workaround, use HTML instead of wiki markup to build the lists.

See also[edit]