Template:Flatlist: Difference between revisions
(Created page with "<div class="hlist {{{class|}}}" style="margin-left: {{#expr:{{{indent|0}}}*1.6}}em; {{{style|}}}">{{#if:{{{1|}}}| {{{1}}} </div>}}<noinclude></div> {{documentation}} </noinclude>") |
mNo edit summary |
||
Line 4: | Line 4: | ||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> | ||
[[Category:Templates]] |
Latest revision as of 19:03, 14 December 2012
Usage[edit source]
{{Flatlist}} starts a horizontal list, such as:
Template:Endflatlist 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 source]
{{flatlist | * [[cat]] * [[dog]] * [[horse]] * [[cow]] * [[sheep]] * [[pig]] }}
- Alternative syntax
{{flatlist}} * [[cat]] * [[dog]] * [[horse]] * [[cow]] * [[sheep]] * [[pig]] {{endflatlist}}
- Syntax for ordered lists
{{flatlist | class=hnum | # [[first]] # [[second]] # [[third]] # [[fourth]] # [[fifth]] # [[sixth]] }}
Parameters[edit source]
- class – adds a CSS class to the containing div. Passing hnum will cause ordered lists to have numbers.
- style – adds CSS style options. 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
- Example:
- 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
- Example:
Technical details[edit source]
This template uses the .hlist
CSS class defined in Common.css to generate horizontal lists. It causes ordinary html list items to be dispayed 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.
Bugs[edit source]
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 Special: pages (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 source]
- {{endflatlist}}
- {{plainlist}}
- {{multi-column numbered list}}
- {{nowrap begin}}/{{nowrap end}}
- {{pagelist}}
- WP:HLIST