|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This page deals with creating lists in Mediawiki. List basicsMediaWiki offers three types of lists. Ordered lists, unordered lists, and definition lists. In the following sections, ordered lists are used for examples. Unordered lists would give corresponding results.
Paragraphs in listsFor simplicity, list items in wiki markup cannot be longer than a paragraph. A following blank line will end the list and reset the counter on ordered lists. Separating unordered list items usually has no noticeable effects. Paragraphs can be forced in lists by using HTML tags. Two line break symbols, For a list with items of more than one paragraph long, adding a blank line between items may be necessary to avoid confusion. Continuing a list item after a sub-itemIn HTML, a list item may contain several sublists, not necessarily adjacent; thus there may be parts of the list item not only before the first sublist, but also between sublists, and after the last one; however, in wiki-syntax, sublists follow the same rules as sections of a page: the only possible part of the list item not in sublists is before the first sublist. In the case of an unnumbered first-level list in wikitext code this limitation can be overcome by splitting the list into multiple lists; indented text between the partial lists may visually serve as part of a list item after a sublist; however, this may give, depending on CSS, a blank line before and after each list, in which case, for uniformity, every first-level list item could be made a separate list. Numbered lists illustrate that what should look like one list may, for the software, consist of multiple lists; unnumbered lists give a corresponding result, except that the problem of restarting with 1 is not applicable.
One level deeper, with a sublist item continuing after a sub-sublist, one gets even more blank lines; however, the continuation of the first-level list is not affected: #list item A1 ##list item B1 ###list item C1 ##:continuing list item B1 ##list item B2 #list item A2 gives
See also m:Template:List demo (backlinks, ) and subdivisions. Changing the list typeThe list type (which type of marker appears before the list item) can be changed in CSS by setting the list-style-type property:
Extra indentation of listsIn a numbered list in a large font, some browsers do not show more than two digits, unless extra indentation is applied (if there are multiple columns: for each column). This can be done with CSS:
ol { margin-left: 2cm}
or alternatively, like below.
To demonstrate that all three methods show all digits of 3-digit numbers, see List demo. Specifying a starting valueSpecifying a starting value is only possible with HTML syntax. (W3C has deprecated the <ol start="9"> <li>Amsterdam</li> <li>Rotterdam</li> <li>The Hague</li> </ol> gives
Or: <ol> <li value="9">Amsterdam</li> <li value="8">Rotterdam</li> <li value="7">The Hague</li> </ol> gives
Comparison with a tableApart from providing automatic numbering, the numbered list also aligns the contents of the items, comparable with using table syntax:
{|
|-
| align=right | 9.||Amsterdam
|-
| align=right | 10.||Rotterdam
|-
| align=right | 11.||The Hague
|}
gives
This non-automatic numbering has the advantage that if a text refers to the numbers, insertion or deletion of an item does not disturb the correspondence. Multi-column bulleted list
{|
|
*1
*2
|
*3
*4
|}
gives:
Multi-column numbered listSpecifying a starting value is useful for a numbered list with multiple columns, to avoid restarting from one in each column. As mentioned above, this is only possible with HTML-syntax (for the first column either wiki-syntax or HTML-syntax can be used). In combination with the extra indentation explained in the previous section:
{| valign="top"
|-
|<ul><ol start="125"><li>a<li>bb<li>ccc</ol></ul>
|<ul><ol start="128"><li>ddd<li>ee<li>f</ol></ul>
|}
gives
Using m:Template:multi-column numbered list (backlinks, ) the computation of the starting values can be automated, and only the first starting value and the number of items in each column except the last has to be specified. Adding an item to, or removing an item from a column requires adjusting only one number, the number of items in that column, instead of changing the starting numbers for all subsequent columns.
{{Multi-column numbered list|125|a<li>bb<li>ccc|3|<li>ddd<li>ee<li>f}}
gives
{{Multi-column numbered list|lst=lower-alpha|125|a<li>bb<li>ccc|3|<li>ddd<li>ee|2|<li>f}}
gives
{{Multi-column numbered list|lst=lower-roman|125|a<li>bb<li>ccc|3|<li>ddd<li>ee|2|<li>f}}
gives
{{Multi-column numbered list|lst=disc|125|a<li>bb<li>ccc|3|<li>ddd<li>ee|2|<li>f}}
gives
Note that the starting values of each column (125, +3, +2) have no effect when the disc list type is used. Streamlined style or horizontal styleIt is also possible to present short lists using very basic formatting, such as: ''Title of list:'' example 1, example 2, example 3 Title of list: example 1, example 2, example 3 This style requires less space on the page, and is preferred if there are only a few entries in the list, it can be read easily, and a direct edit point is not required. The list items should start with a lowercase letter unless they are proper nouns. TablesA one-column table is very similar to a list, but it allows sorting. If the wikitext itself is already sorted with the same sortkey, this advantage does not apply. A multiple-column table allows sorting on any column. See also en:Wikipedia:When to use tables. Changing unordered lists to ordered onesWith the CSS
ul { list-style: decimal }
unordered lists are changed to ordered ones. This applies (as far as the CSS selector does not restrict this) to all ul-lists in the HTML source code:
Since each special page, like other pages, has a class based on the pagename, one can separately specify for each type whether the lists should be ordered, see Help:User contributions#User styles and Help:What links here#User styles. However, it does not seem possible to make all page history lists ordered (unless one makes all lists ordered), because the class name is based on the page for which the history is viewed. See also
Wikipedia-specific help
This page is a copy of the master help page at Meta (for general help information all Wikimedia projects can use), with two Wikipedia-specific templates inserted. To update the main text, edit the master help page for all projects at m:Help:List. For Wikipedia-specific issues, use Template:Ph:List (the extra text at the bottom of this page) or Template:Phh:List for a Wikipedia-specific lead (text appears at the top of this page). You are welcome to replace the full wikitext of this page with that of the master page at Meta at any time. To view this page in other languages see the master page at Meta. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| All Right Reserved © 2007, Designed by Stylish Blog. |