Template:Alternating rows table section: Difference between revisions
Jump to navigation
Jump to search
Ported from [http://magmmlcontest.com/wiki/index.php/Template:Alternating_rows_table_section the MAGMMLC wiki] |
mNo edit summary |
||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<includeonly> | |||
{{#if:{{{1|}}}| | {{#if:{{{1|}}}| | ||
{{!}}- style="{{{os|}}}" | {{!}}- style="{{{os|}}}" | ||
Line 101: | Line 102: | ||
{{!}}- style="{{#ifexpr: ({{ #ifeq: {{{1}}} || 0 | 1 }} + {{ #ifeq: {{{2}}} || 0 | 1 }} + {{ #ifeq: {{{3}}} || 0 | 1 }} + {{ #ifeq: {{{4}}} || 0 | 1 }} + {{ #ifeq: {{{5}}} || 0 | 1 }} + {{ #ifeq: {{{6}}} || 0 | 1 }} + {{ #ifeq: {{{7}}} || 0 | 1 }} + {{ #ifeq: {{{8}}} || 0 | 1 }} + {{ #ifeq: {{{9}}} || 0 | 1 }} + {{ #ifeq: {{{10}}} || 0 | 1 }} + {{ #ifeq: {{{11}}} || 0 | 1 }} + {{ #ifeq: {{{12}}} || 0 | 1 }} + {{ #ifeq: {{{13}}} || 0 | 1 }} + {{ #ifeq: {{{14}}} || 0 | 1 }} + {{ #ifeq: {{{15}}} || 0 | 1 }} + {{ #ifeq: {{{16}}} || 0 | 1 }} + {{ #ifeq: {{{17}}} || 0 | 1 }} + {{ #ifeq: {{{18}}} || 0 | 1 }} + {{ #ifeq: {{{19}}} || 0 | 1 }} + {{ #ifeq: {{{20}}} || 0 | 1 }} + {{ #ifeq: {{{21}}} || 0 | 1 }} + {{ #ifeq: {{{22}}} || 0 | 1 }} + {{ #ifeq: {{{23}}} || 0 | 1 }} + {{ #ifeq: {{{24}}} || 0 | 1 }} + {{ #ifeq: {{{25}}} || 0 | 1 }} + {{ #ifeq: {{{26}}} || 0 | 1 }} + {{ #ifeq: {{{27}}} || 0 | 1 }} + {{ #ifeq: {{{28}}} || 0 | 1 }} + {{ #ifeq: {{{29}}} || 0 | 1 }} + {{ #ifeq: {{{30}}} || 0 | 1 }} + {{ #ifeq: {{{31}}} || 0 | 1 }} + {{ #ifeq: {{{32}}} || 0 | 1 }} + {{ #ifeq: {{{33}}} || 0 | 1 }}) mod 2 = 0 | {{{os|}}} | {{{es|}}} }}" | {{!}}- style="{{#ifexpr: ({{ #ifeq: {{{1}}} || 0 | 1 }} + {{ #ifeq: {{{2}}} || 0 | 1 }} + {{ #ifeq: {{{3}}} || 0 | 1 }} + {{ #ifeq: {{{4}}} || 0 | 1 }} + {{ #ifeq: {{{5}}} || 0 | 1 }} + {{ #ifeq: {{{6}}} || 0 | 1 }} + {{ #ifeq: {{{7}}} || 0 | 1 }} + {{ #ifeq: {{{8}}} || 0 | 1 }} + {{ #ifeq: {{{9}}} || 0 | 1 }} + {{ #ifeq: {{{10}}} || 0 | 1 }} + {{ #ifeq: {{{11}}} || 0 | 1 }} + {{ #ifeq: {{{12}}} || 0 | 1 }} + {{ #ifeq: {{{13}}} || 0 | 1 }} + {{ #ifeq: {{{14}}} || 0 | 1 }} + {{ #ifeq: {{{15}}} || 0 | 1 }} + {{ #ifeq: {{{16}}} || 0 | 1 }} + {{ #ifeq: {{{17}}} || 0 | 1 }} + {{ #ifeq: {{{18}}} || 0 | 1 }} + {{ #ifeq: {{{19}}} || 0 | 1 }} + {{ #ifeq: {{{20}}} || 0 | 1 }} + {{ #ifeq: {{{21}}} || 0 | 1 }} + {{ #ifeq: {{{22}}} || 0 | 1 }} + {{ #ifeq: {{{23}}} || 0 | 1 }} + {{ #ifeq: {{{24}}} || 0 | 1 }} + {{ #ifeq: {{{25}}} || 0 | 1 }} + {{ #ifeq: {{{26}}} || 0 | 1 }} + {{ #ifeq: {{{27}}} || 0 | 1 }} + {{ #ifeq: {{{28}}} || 0 | 1 }} + {{ #ifeq: {{{29}}} || 0 | 1 }} + {{ #ifeq: {{{30}}} || 0 | 1 }} + {{ #ifeq: {{{31}}} || 0 | 1 }} + {{ #ifeq: {{{32}}} || 0 | 1 }} + {{ #ifeq: {{{33}}} || 0 | 1 }}) mod 2 = 0 | {{{os|}}} | {{{es|}}} }}" | ||
{{{34|}}} }} {{{{#if:{{{34|}}}|1x|void}}| | {{{34|}}} }} {{{{#if:{{{34|}}}|1x|void}}| | ||
}}<noinclude> | }}</includeonly><noinclude> | ||
===Usage=== | |||
'''Alternating rows table section''' allows for the dynamic creation of tables that use alternating styles for odd and even numbered rows, typically in conjunction with a template which generates a table where some rows may not be present every time. | |||
There are two named arguments to this template: | |||
;os:Defines the CSS style for odd-numbered rows. | |||
;es:Defines the CSS style for even-numbered rows. | |||
==Example== | |||
<pre> | |||
<nowiki> | |||
{| class="wikitable" | |||
! Place !! Result | |||
{{Alternating rows table section|es=background:#f0f0f0; | |||
| {{!}} First {{!!}} 100 | |||
| {{!}} Second {{!!}} 95 | |||
| <!-- empty! --> | |||
| {{!}} Third {{!!}} 87 | |||
| <!-- empty! --> | |||
| {{!}} Fourth {{!!}} 65 | |||
| {{!}} Fifth {{!!}} 58 | |||
}} | |||
|} | |||
</nowiki></pre> | |||
{| class="wikitable" | |||
! Place !! Result | |||
{{Alternating rows table section|es=background:#f0f0f0; | |||
| {{!}} First {{!!}} 100 | |||
| {{!}} Second {{!!}} 95 | |||
| <!-- empty! --> | |||
| {{!}} Third {{!!}} 87 | |||
| <!-- empty! --> | |||
| {{!}} Fourth {{!!}} 65 | |||
| {{!}} Fifth {{!!}} 58 | |||
}} | |||
|}</noinclude><noinclude>[[Category:Templates]] [[Category:Wiki Template]]</noinclude> |
Latest revision as of 16:26, 9 August 2024
Usage
Alternating rows table section allows for the dynamic creation of tables that use alternating styles for odd and even numbered rows, typically in conjunction with a template which generates a table where some rows may not be present every time.
There are two named arguments to this template:
- os
- Defines the CSS style for odd-numbered rows.
- es
- Defines the CSS style for even-numbered rows.
Example
{| class="wikitable" ! Place !! Result {{Alternating rows table section|es=background:#f0f0f0; | {{!}} First {{!!}} 100 | {{!}} Second {{!!}} 95 | <!-- empty! --> | {{!}} Third {{!!}} 87 | <!-- empty! --> | {{!}} Fourth {{!!}} 65 | {{!}} Fifth {{!!}} 58 }} |}
Place | Result |
---|---|
First | 100 |
Second | 95 |
Third | 87 |
Fourth | 65 |
Fifth | 58 |