Difference between revisions of "Template:Election table/doc"
imported>Plastikspork (Align) |
imported>Plastikspork (→Options: fix) |
||
| Line 110: | Line 110: | ||
To add <code><nowiki>class="sortable"</nowiki></code>, use <code><nowiki>...|sortable=yes}}</nowiki></code>. If you use this, you will need to edit your table to have <code><nowiki>|- class="unsorted"</nowiki></code> as the row separator for the total row. Sorted tables do not currently work with tables using <code>colspan</code>. | To add <code><nowiki>class="sortable"</nowiki></code>, use <code><nowiki>...|sortable=yes}}</nowiki></code>. If you use this, you will need to edit your table to have <code><nowiki>|- class="unsorted"</nowiki></code> as the row separator for the total row. Sorted tables do not currently work with tables using <code>colspan</code>. | ||
| − | To align the table on the right side of the page, use code><nowiki>...|align=right}}</nowiki></code>. | + | To align the table on the right side of the page, use <code><nowiki>...|align=right}}</nowiki></code>. |
<includeonly> | <includeonly> | ||
Revision as of 19:30, 19 October 2009
| This is a documentation subpage for Template:Election table. It contains usage information, categories and other content that is not part of the original template page. |
Usage
This template marks the beginning of a table and defines borders, margins, background colours, and text alignment within the table. (Default alignment is "right", others must be specified.) Table rows and cells are written as usual, and the table is closed with "|}"
For example, to have a table as shown below, include the code shown to the right:
{{electiontable|Table template pagename}}
'''Summary of [[Mars|Martian]] election results,
2020'''
|-style="background:#E9E9E9;"
!colspan="2" align="left"|Parties
!Votes
!%
!+/-
!Seats
!+/-
|-
|bgcolor="#ff0000"|
|align="left"|The red party
|6042
|45.40
| -4.41
|23
| -2
|-
|bgcolor="#00ff00"|
|align="left"|The green party
|5678
|42.67
| +1.23
|21
|0
|-
|bgcolor="#0000ff"|
|align="left"|Free Mars
|345
|2.59
| +2.59
|1
| +1
|-
|bgcolor="#eeeeee"|
|align="left"|None of the above (unfilled seats)
|1242
|9.33
| +.59
|5
| +1
|-style="background:#E9E9E9;"
!colspan="2" align="left"|Total
!13307
!align="center" colspan="2"|100%
!align="center" colspan="2"|50
|}
|
| Parties | Votes | % | +/- | Seats | +/- | |
|---|---|---|---|---|---|---|
| The red party | 6042 | 45.40 | -4.41 | 23 | -2 | |
| The green party | 5678 | 42.67 | +1.23 | 21 | 0 | |
| Free Mars | 345 | 2.59 | +2.59 | 1 | +1 | |
| None of the above (unfilled seats) | 1242 | 9.33 | +.59 | 5 | +1 | |
| Total | 13307 | 100% | 50 | |||
Options
Instead of {{electiontable|template pagename}} '''Title''' you can use {{electiontable|template pagename|Title}}
To add class="sortable", use ...|sortable=yes}}. If you use this, you will need to edit your table to have |- class="unsorted" as the row separator for the total row. Sorted tables do not currently work with tables using colspan.
To align the table on the right side of the page, use ...|align=right}}.