Template:Col-end
![]() | This template creates a table rather than actual columns. This means that it may display poorly on mobile devices and others with narrow screens, and is sub-optimal in terms of accessibility. Approximately ⅔ of visitors are using mobile devices and may have trouble reading the content that is wrapped in this template. Please consider using one of the CSS-based column templates instead, or not using columns at all if there are any issues that affect page layout. |
![]() | This template uses TemplateStyles: |
The {{Col-begin}}
, {{Col-break}}
and {{Col-end}}
templates control columns of text on a page:
{{Col-begin}}
starts a table (followed by{{Col-break}}
for the 1st column){{Col-break}}
triggers the start of each subsequent column, and{{Col-end}}
ends the multi-column table.
The widths of columns can be specified by using various additional codes; see below for examples.
Usage
[edit]{{Col-begin|width=70%}}
: Start table with specific width.
{{Col-break|width=67%}}
: Start first column as 67% wide.
This is text in column 1.
{{Col-break|width=33%}}
: Start second column as 33% wide.
This is text in column 2.
{{Col-end}}
The table will have two columns, with the first column twice (2×) the width of the second column.
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 viewport. 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 as follows:
{{Col-begin|width=95%}}
|-
|
Left column
|
Right column
|}
|
When more columns are needed, the following syntax is used:
{{Col-begin}}
|
Examples
[edit]{{Col-begin}}
{{Col-break}}
{| class="wikitable" style="width: 18em;"
|+ Production by year
! 1980
| 50,000
|-
! 1990
| 75,000
|-
! 2000
| 90,000
|}
{{Col-break}}
{| class="wikitable" style="width: 18em;"
|+ Profit by year
! 1980
| $6,000
|-
! 1990
| $7,500
|-
! 2000
| $8,200
|}
{{Col-end}}
…which renders as…
|
|
{{Col-begin}}
{{Col-break|width=80%}}
{| class="wikitable" style="width: 18em;"
|+ Production by year
! 1980
| 50,000
|-
! 1990
| 75,000
|-
! 2000
| 90,000
|}
{{Col-break|width=20%}}
{| class="wikitable" style="width: 18em;"
|+ Profit by year
! 1980
| $6,000
|-
! 1990
| $7,500
|-
! 2000
| $8,200
|}
{{Col-end}}
…which renders as…
|
|
{{Col-begin|width=auto}}
{{Col-break}}
{| class="wikitable" style="width: 18em;"
|+ Production by year
! 1980
| 50,000
|-
! 1990
| 75,000
|-
! 2000
| 90,000
|}
{{Col-break|gap=2em}}
{| class="wikitable" style="width: 18em;"
|+ Profit by year
! 1980
| $6,000
|-
! 1990
| $7,500
|-
! 2000
| $8,200
|}
{{Col-end}}
…which renders as…
|
|
{{Col-begin}}
{{Col-break}}
{| class="wikitable" style="width: 18em;"
|+ Production by year
! 1980
| 50,000
|-
! 1990
| 75,000
|-
! 2000
| 90,000
|}
{{Col-break}}
{| class="wikitable" style="width: 18em;"
|+ Profit by year
! 1980
| $6,000
|-
! 1990
| $7,500
|-
! 2000
| $8,200
|}
{{Col-break}}
{| class="wikitable" style="width: 18em;"
|+ Revenue by product
! Widgets
| $25,000
|-
! Foos
| $65,500
|-
! Bars
| $28,000
|}
{{Col-end}}
…which renders as…
|
|
|
TemplateData
[edit]Col-end
This template starts a multi-column table.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Table width | width | The width of the complete table as a percentage
| String | optional |
Background color | bgcolor bgColor | Set the background color of the table
| String | optional |
CSS class | class | Extra class beyond "col-begin" | String | optional |
CSS style | style | Extra CSS | String | optional |
Border style | border | CSS border style | String | optional |
Small text | small | Set for smaller text | String | optional |
See also
[edit]- {{Column list}}
- {{Columns-list}}
- {{Div col}}
- {{Div col end}}
- {{Multicol}}
- {{Multicol-break}}
- {{Multicol-section}}
- {{Multicol-end}}
The above documentation is transcluded from Template:Col-begin/doc (edit | history). Editors can experiment in this template's sandbox (create | mirror) and testcases (create) page. Subpages of this template. |