More actions
{{#switch:col-begin template | col-2 = The Template:Col-2 sets column width for each of two columns, with align=left, valign=top. The align or valign can be changed: {{col-2 |align=right|valign=center}}. | col-3 = The Template:Col-3 sets column width for each of three columns, with align=left, valign=top. The align or valign can be changed: {{col-3|align=right|valign=center}}. | col-4 = The Template:Col-4 sets column width for each of four columns. | col-5 = The Template:Col-5 sets column width for each of five columns. | col-6 = The Template:Col-6 sets column width for each of six columns, with align=left, valign=top. The width, align or valign can be changed: {{col-6 |width=20%|align=right|valign=center}}. | col-start=The Template:Col-start begins a wikitable (same as {{col-begin}}). }} The Template:Tl, Template:Tl and Template:Tl templates control columns of text on a page:
- {{col-begin}}: starts a table (followed by {{col-break}} for 1st column)
- {{col-break}}: triggers the start of each column
- {{col-end}}: ends the multi-column table.
The widths of columns can be specified by using various additional codes. See below for examples.
Usage
Template:Tlc: start table with specific width.
Template:Tlc: start column-1 as 66% wide.
This is text in column-1.
Template:Tlc: start column-2 as 33% wide.
This is text in column-2.
Template:Tlc
The table will have two columns, with column 1 twice (2×) the width of column 2.
A border of 2px (1px width on each side) corresponds to a 5%. Therefore, with a 2px border, the width needs to be 95% for the table to fit within the screen. Since it's possible that some tables might not have a border, correction on the individual page could be made after substitution. Another way to create a two column table is like this:
<syntaxhighlight lang="wikitext"> <templatestyles src="Col-begin/styles.css"/>
}}
</syntaxhighlight> |
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
Template:Tl Template:Tl Column 1 here Template:Tl Column 2 here Template:Tl |
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: 2em|padding-left: 2em;}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
Template:Tl Template:Tl Column 1 here Template:Tl Column 2 here Template:Tl Column 3 here Template:Tl |
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: 2em|padding-left: 2em;}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
and so on, up to Template:Tl |
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
{{Col-begin}} Template:Tl Column 1 here Template:Tl Column 2 here Template:Tl Column 3 here Template:Tl Column 4 here Template:Tl Column 5 here Template:Tl Column 6 here Template:Tl
|
Examples
Here are some example codes that you can use to make columns of text in your Wikipedia article. You can change the width of your columns by changing the code words that go between the text of your columns. Good luck!
Template:Hidden begin <syntaxhighlight lang="wikitext">
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
</syntaxhighlight>
gives:
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
Template:Hidden begin <syntaxhighlight lang="wikitext">
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: ;}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: ;}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: ;}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: ;}}{{#if:|{{{style}}}}}"}} |
|
</syntaxhighlight>
gives:
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: ;}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: ;}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: ;}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: ;}}{{#if:|{{{style}}}}}"}} |
|
Template:Hidden begin <syntaxhighlight lang="wikitext">
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:80%|width: 80%;}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:20%|width: 20%;}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
</syntaxhighlight>
gives:
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:80%|width: 80%;}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:20%|width: 20%;}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
Template:Hidden begin <syntaxhighlight lang="wikitext">
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: 2em|padding-left: 2em;}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
</syntaxhighlight>
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: 2em|padding-left: 2em;}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
Template:Hidden begin <syntaxhighlight lang="wikitext">
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
</syntaxhighlight>
gives:
<templatestyles src="Col-begin/styles.css"/>
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
style="{{#if:|width: {{{width}}};}}{{#if:|text-align: {{{align}}};}} {{#if: |padding-left: {{{gap}}};}}{{#if:|vertical-align: {{{valign}}};}}{{#if:|{{{style}}}}}"}} |
|
See also
Column-generating template families
The templates listed here are not interchangeable. For example, using Template:Tl with Template:Tl instead of Template:Tl would leave a Template:Tag open, potentially harming any subsequent formatting. <section begin="table" />
Type | Family | Template:Longitem | Responsive/ mobile suited |
Start template | Column divider | End template |
---|---|---|---|---|---|---|
Float | "col-float" | Template:Yes | Template:Yes | Template:Tl | Template:Tl | Template:Tl |
"columns-start" | Template:Yes | Template:Yes | Template:Tl | Template:Tl | Template:Tl | |
Columns | "div col" | Template:Yes | Template:Yes | Template:Tl | – | Template:Tl |
"columns-list" | Template:No | Template:Yes | Template:Tl (wraps div col) | – | – | |
Flexbox | "flex columns" | Template:No | Template:Yes | Template:Tl | – | – |
Table | "col" | Template:Yes | Template:No | Template:Tl, Template:Tl or Template:Tl |
Template:Tl or Template:Tl .. Template:Tl |
Template:Tl |
Template:Sup Can template handle the basic wiki markup {| | || |- |}
used to create tables? If not, special templates that produce these elements (such as Template:Tl, Template:Tl, Template:Tl, Template:Tl, Template:Tl)—or HTML tags (Template:Tag, Template:Tag, etc.)—need to be used instead.<section end="table" />