Difference between revisions of "Template:Table"
From From The Ashes Wiki
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{#css: | {{#css: | ||
| − | {{#if:{{{center | + | {{#if:{{#regex:{{{options|}}}|/center/}}|.templatetable { |
margin: 0 auto; | margin: 0 auto; | ||
}}} | }}} | ||
| Line 6: | Line 6: | ||
padding: .5em; | padding: .5em; | ||
} | } | ||
| − | .templatetable td:first-child { | + | {{#if:{{#regex:{{{options|}}}|/bold/}}|.templatetable td:first-child { |
font-weight: bold; | font-weight: bold; | ||
| − | } | + | }}} |
| − | .templatetable td:first-child::after { | + | {{#if:{{#regex:{{{options|}}}|/colon/}}|.templatetable td:first-child::after { |
content: ":"; | content: ":"; | ||
| − | } | + | }}} |
| − | }}{{#vardefine:current|1}} | + | }}<includeonly>{{#vardefine:current|1}}<table class="templatetable {{{class|}}}" style="{{{style|}}}"> |
| − | <table class="{{{class| | ||
<tr> | <tr> | ||
{{#fornumargs: number | {{#fornumargs: number | ||
| Line 20: | Line 19: | ||
}} | }} | ||
</tr> | </tr> | ||
| − | </table> | + | </table></includeonly><noinclude>{{#css: |
| − | [[Category:Template]] | + | .nothing.templatetable { |
| + | margin: 0; | ||
| + | } | ||
| + | .templatetable td { | ||
| + | padding: .5em; | ||
| + | } | ||
| + | .nothing.templatetable td:first-child { | ||
| + | font-weight: normal; | ||
| + | } | ||
| + | .nothing.templatetable td:first-child::after { | ||
| + | content: ""; | ||
| + | } | ||
| + | }} | ||
| + | ==Usage== | ||
| + | <pre> | ||
| + | {{Table | ||
| + | | options = any combination of: center colon bold | ||
| + | | class = add a custom class to your table | ||
| + | | style = inline css to style your table (using {{#css: }} on your page is more flexible though) | ||
| + | | cols = N (Default 2) | ||
| + | | <thing> each line is a cell; notice there are no equals signs | ||
| + | | <thing> | ||
| + | | <thing> | ||
| + | [...] | ||
| + | | <thing> | ||
| + | }} | ||
| + | </pre> | ||
| + | |||
| + | ==Examples== | ||
| + | |||
| + | <pre>{{Table | ||
| + | | Topic | ||
| + | | Info | ||
| + | | Another topic | ||
| + | | More info | ||
| + | }}</pre> | ||
| + | |||
| + | gives: | ||
| + | |||
| + | {{Table | ||
| + | | class = nothing | ||
| + | | Topic | ||
| + | | Info | ||
| + | | Another topic | ||
| + | | More info | ||
| + | }} | ||
| + | |||
| + | <pre>{{Table | ||
| + | | options = bold colon center | ||
| + | | cols = 3 | ||
| + | | Topic | ||
| + | | Info | ||
| + | | Oh and this | ||
| + | | Another topic | ||
| + | | More info | ||
| + | | Third Thing | ||
| + | | Yet more info | ||
| + | | Also | ||
| + | | This stuff | ||
| + | }}</pre> | ||
| + | |||
| + | gives: | ||
| + | |||
| + | {{Table | ||
| + | | options = bold colon center | ||
| + | | cols = 3 | ||
| + | | Topic | ||
| + | | Info | ||
| + | | Oh and this | ||
| + | | Another topic | ||
| + | | More info | ||
| + | | Third Thing | ||
| + | | Yet more info | ||
| + | | Also | ||
| + | | This stuff | ||
| + | }} | ||
| + | [[Category:Template]]</noinclude> | ||
Latest revision as of 06:25, 19 March 2018
Usage
{{Table
| options = any combination of: center colon bold
| class = add a custom class to your table
| style = inline css to style your table (using {{#css: }} on your page is more flexible though)
| cols = N (Default 2)
| <thing> each line is a cell; notice there are no equals signs
| <thing>
| <thing>
[...]
| <thing>
}}
Examples
{{Table
| Topic
| Info
| Another topic
| More info
}}
gives:
| Topic | Info |
| Another topic | More info |
{{Table
| options = bold colon center
| cols = 3
| Topic
| Info
| Oh and this
| Another topic
| More info
| Third Thing
| Yet more info
| Also
| This stuff
}}
gives:
| Topic | Info | Oh and this |
| Another topic | More info | Third Thing |
| Yet more info | Also | This stuff |