Šablona:Columns-start/doc
Šablona:Mbox[[Category:MediaWiki documentation pages{{#translation:}}]]
Warning | This template is used on approximately 2 200 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Chyba Lua: callParserFunction: function "#translation" was not found. The columns-start template and its child templates column and columns-end can be used to make a fixed number of columns (up to 5) that will span the entire page above a certain minimum width (100 ems for 5 columns, 80 for 4, 60 for 3 and 2). Below the minimum width, each column starting from the right will gracefully display below another one of the columns.
Use
The below examples are using the templates directly, so you can see what will happen if the minimum size is reached.
<syntaxhighlight lang="wikitext">
Column 1 here
Column 2 here
</syntaxhighlight>
<syntaxhighlight lang="wikitext">
Column 1 here
Column 2 here
Column 3 here
</syntaxhighlight>
<syntaxhighlight lang="wikitext">
Column 1 here
Column 2 here
Column 3 here
Column 4 here
</syntaxhighlight>
<syntaxhighlight lang="wikitext">
Column 1 here
Column 2 here
Column 3 here
Column 4 here
Column 5 here
</syntaxhighlight>
Parameters
Columns-start has these parameters:
|num=
- Set the number of columns. Defaults to 2. The template will work with up to 5 columns. More than that should prefer a custom implementation or another solution (such as a wikitable for tabular content or {{Div col }} for list content).
|class=
- Apply another class to the set of columns, such as
hlist
. Default is none. |bgcolor=
- Set a background color. Default is transparent.
|width=
- Set a total width in which all columns must appear. Default is 100%.
Template:Column has the same parameters where it is used as a "wrapper" template with numbered columns. Example:
<syntaxhighlight lang="wikitext">
Column 1 here
</syntaxhighlight>
<syntaxhighlight lang="wikitext">
Column 1 here
Column 2 here
</syntaxhighlight>
In the second example, be aware of the possible problem with a column that includes an equals sign. See Help:Templates#Equals for more information.
Otherwise, Template:Column must be used as above with Template:Columns-start.
Example
This is an example from List of Indonesia-related topics:
Palaces in Indonesia
Prisons
Shopping malls
Towers
Limitations
Using headings inside {{Column }} in its wrapper form functions so long as there is some content beneath the 2nd and later heading. Secondly, headings will not carry an edit link. The below table may wrap (i.e. not display as columns) but displays the issue.
Content | Functional but missing edit links | Non-functional (missing content) |
---|---|---|
Wikitext | <syntaxhighlight lang="wikitext">
Ex. heading 1ABC Ex. heading 2DEF</syntaxhighlight> |
<syntaxhighlight lang="wikitext">
Ex. heading 3
==== Ex. heading 4 ==== </syntaxhighlight> |
Rendered | Ex. heading 1ABC Ex. heading 2DEF |
Ex. heading 3
==== Ex. heading 4 ==== |
See also
Column-generating template families
The templates listed here are not interchangeable. For example, using {{Col-float }} with {{Col-end }} instead of {{Col-float-end }} would leave a HTML "div" (division) open, potentially harming any subsequent formatting. <section begin="table" />
Type | Family | Handles wiki
table code?† |
Responsive/ Mobile suited |
Start template | Column divider | End template |
---|---|---|---|---|---|---|
Float | "col-float" | Yes | Yes | {{Col-float }} | {{Col-float-break }} | {{Col-float-end }} |
"columns-start" | Yes | Yes | {{Columns-start }} | {{Column }} | {{Columns-end }} | |
Columns | "div col" | Yes | Yes | {{Div col }} | – | {{Div col end }} |
"columns-list" | No | Yes | {{Columns-list }} (wraps div col) | – | – | |
Flexbox | "flex columns" | No | Yes | {{Flex columns }} | – | – |
Table | "col" | Yes | No | {{Col-begin }}, {{Col-begin-fixed }} or {{Col-begin-small }} |
{{Col-break }} or {{Col-2 }} .. {{Col-5 }} |
{{Col-end }} |
† Can template handle the basic wiki markup {| | || |- |}
used to create tables? If not, special templates that produce these elements (such as {{(! }}, {{! }}, {{!! }}, {{!- }}, {{!) }})—or HTML tags (<table>...</table>
, <tr>...</tr>
, etc.)—need to be used instead.<section end="table" />