Template:Div col/doc
{{#ifeq:doc |doc
|
{{#ifeq:show |show
| {{#invoke:Message box|mbox}} }}{{#if: | | {{#ifexist:Template:Div col | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]] | }} }} | }}
{{#invoke:Message box|ombox}} {{#invoke:Message box|ombox}}
Property | Internet Explorer |
Firefox | Safari | Chrome | Opera |
---|---|---|---|---|---|
column-width column-count |
|||||
columns | |||||
break-before break-after break-inside |
No | No | No | ||
{{#invoke:Navbar|navbar}} |
{{[[{{#if:|{{{SISTER}}}Template|Template}}:Div col|Div col]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} can be used to make a list into columns that wrap properly and compatibly with portable computer devices, esp. PAD operating systems and small screens. It automatically breaks the available space into equal spaces, meaning, for instance, that it is not necessary to work out the halfway point, or the one-third & two-thirds points between two columns.
- The list content is either provided by the
|{{#if:content|content=}}
parameter (which can be restrictive of what content is allowed; e.g., wiki markup like | must somehow be escaped) or terminated with {{[[{{#if:|{{{SISTER}}}Template|Template}}:div col end|div col end]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}. The {{[[{{#if:|{{{SISTER}}}Template|Template}}:columns-list|columns-list]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} wrapper uses the parameter method for providing content (including its limitations). - The template system (family) also offers parameter options to set a smaller (90%) font-size parameter (
|{{#if:small|small=}}yes
), place vertical lines parameter ("rules") between the columns (|{{#if:rules|rules=}}
) and to add other custom styling parameter (|{{#if:style|style=}}
).
{{[[{{#if:|{{{SISTER}}}Template|Template}}:Div col|Div col]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} can create multiple columns in web browsers which support one of the following CSS properties:
- column-count (for CSS3-compliant browsers; see CSS3 module: Multi-column layout)
- -moz-column-count (for Mozilla/Gecko-based browsers such as Firefox)
- -webkit-column-count (for WebKit-based browsers such as Safari and Google Chrome)
Usage
There are six parameters for this template and their usage is described below.
|{{#if:colwidth|colwidth=}}
- Specifies the minimum width of the columns and determines automatically the number of columns based on screen width (i.e. more columns will be shown on wider displays). Overrides cols. Can be specified in any CSS unit, for instance in em, about the width of a capital "M", e.g,
colwidth=20em
|{{#if:rules|rules=}}
- Adds vertical lines ("rules") between the columns if set to
yes
or some CSS styling (e.g.1px dashed blue;
). |{{#if:gap|gap=}}
- Specifies the space between the content of adjacent columns. Specified in any CSS unit, e.g,
gap=2em
. The default spacing (set by browser) is 1em. |{{#if:style|style=}}
- CSS styling to apply to the columns.
|{{#if:content|content=}}
- content to apply to the columns.
or first unnamed parameter|{{#if:cols|cols=}}
- (Now deprecated, as colwidth, above, is better suited to flexible formatting for a variety of display screen sizes (from mobile phones, tablets, etc to widescreen cinema-style displays))
Specifies the number of columns (default 2).
Examples
Usage of "colwidth" parameter
Important: The usage of the previous parameter "cols" is deprecated. It is strongly recommended to not use now-deprecated "cols" parameter (please leave it blank) and instead use "colwidth" parameter.
- Example with column width of 10em
Note the empty column for the "number of columns" between "Div col" and "10em". {{div col||10em}} * a * b * c * d * e * f * g * h {{div col end}}
- produces
}}{{#ifeq: |yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
Usage of "rules" parameter
- Example
{{Div col|rules=yes}} * a * b * c * d * e * f * g * h {{Div col end}}
- produces
}}{{#ifeq: |yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
Usage of "gap" parameter
- Example
{{Div col|colwidth=10em|rules=yes|gap=2em}} * a * b * c * d * e * f * g * h {{Div col end}}
- produces
}}{{#ifeq: |yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
Usage of "small" parameter
- Example showing how setting "small" parameter to "yes" produces smaller font size
{{Div col|small=yes}} * a * b * c * d * e * f * g * h {{Div col end}}
- produces
}}{{#ifeq: yes|yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
Usage of "content" parameter
- Example showing how to provide "content" parameter without using {{[[{{#if:|{{{SISTER}}}Template|Template}}:Div col end|Div col end]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
{{Div col|colwidth=10em|content= * a * b * c * d * e * f * g * h }}
- produces
- b
- c
- d
- e
- f
- g
- h
|* a
- b
- c
- d
- e
- f
- g
- h
}}{{#ifeq: |yes
|}}
Usage with multiple named parameters
When parameters are named in the template, they can be used in any order. Example:
{{Div col|colwidth=10em|rules=yes|gap=2em|small=yes}} * a * b * c * d * e * f * g * h {{Div col end}}
or
{{Div col|rules=yes|gap=2em|small=yes|colwidth=10em}} * a * b * c * d * e * f * g * h {{Div col end}}
- produces
}}{{#ifeq: yes|yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
and exactly the same result below
}}{{#ifeq: yes|yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
- Example with column width of 20em
{{div col||20em}} * a * b * c * d * e * f * g * h {{div col end}}
- produces
}}{{#ifeq: |yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
- Example with column width of 30em
{{div col||30em}} * a * b * c * d * e * f * g * h {{div col end}}
- produces
}}{{#ifeq: |yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
- Example of how this template behaves if no bullets (generated by asterisk mark) are used.
{{div col||10em}} a b c d e f g h {{div col end}}
- produces
}}{{#ifeq: |yes
|}}
a b c d e f g h
Deprecated usage
Usage without parameters
Usage of fixed column counts is deprecated, therefore this example should no longer be used as well.
Example with no parameters produces two columns as the default is two columns.
{{Div col}} * a * b * c * d * e * f * g * h {{Div col end}}
- produces
}}{{#ifeq: |yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
Usage of parameters without naming the parameters
Usage of fixed column counts is deprecated, therefore this example should no longer be used as well. When parameters are not named then template considers first unnamed parameter to be "cols", second unnamed parameter to be "colwidth", remaining unnamed parameters (e.g. third, fourth, fifth, etc. unnamed parameter) will be ignored by the template without providing an error message. The first and second parameter "cols" and "colwidth" could be unnamed but all other parameters (such as "rules", "gap", "style" and "small") must always be named in the template.
- Example with correct usage of unnamed parameters
Note the empty column for the "number of columns" between "Div col" and "10em".
{{div col||10em|rules=yes|gap=2em|small=yes}} * a * b * c * d * e * f * g * h {{div col end}}
- produces
}}{{#ifeq: yes|yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
- Example with incorrect usage of unnamed parameters
Note that the unnamed third, fourth and fifth parameters will be ignored by the template. If used, then third, fourth and fifth parameters must always be named.
{{div col||10em|yes|2em|yes}} * a * b * c * d * e * f * g * h {{div col end}}
- produces (unnamed third, fourth and fifth parameters are ignored)
}}{{#ifeq: |yes
|}}
- a
- b
- c
- d
- e
- f
- g
- h
Usage of "cols" parameter
Important: Use of now-deprecated "cols" parameter is discouraged, leave it blank and instead use the "colwidth" parameter.
left|center}}; {{safesubst:#if:|color: {{{fc}}};|}}" | deprecated example
{{safesubst:#if: |
- | The following is a closed debate. Template:Strongbad }} | ||
---|---|---|---|---|
{{Div col|3}} * a * b * c * d * e * f * g * h {{Div col end}}
{{#if:
|
yes | }}
{{Div col|4}} * a * b * c * d * e * f * g * h {{Div col end}}
{{#if:
|
yes | }}
|
TemplateData
See the monthly error report for this template.
TemplateData for Div col
{{#ifeq:doc|sandbox||
}} {{#switch: Div col |Div col=<templatedata> {
"description": "Breaks a list into columns. It automatically breaks each column to an equal space, so you do not manually have to find the half way point on two columns. The list is provided by |content= or closed with .",
"params": { "cols": { "label": "cols", "description": "Specifies the number of columns.", "type": "number", "default": "2", "aliases": [ "1" ], "required": false, "deprecated": "Use colwidth parameter instead, so that the layout resizes according to the screen" }, "colwidth": { "label": "Column width", "description": "Specifies the width of columns, and determines dynamically the number of columns based on screen width; more columns will be shown on wider displays. This overrides the 'cols' setting.", "type": "string", "aliases": [ "2" ], "required": false, "example": "30em", "suggested": true }, "rules": { "label": "Rules", "description": "Produces vertical rules between the columns if set to yes.", "type": "string", "required": false, "example": "'yes' or '1px dashed blue'" }, "gap": { "label": "Gap size", "description": "Specifies the space between the content of adjacent columns.", "type": "string", "required": false, "example": "2em" }, "style": { "label": "CSS style", "description": "Specifies any custom styling.", "type": "string", "required": false }, "content": { "label": "Content", "description": "Specifies the content to divide into columns", "type": "string", "required": false }, "small": { "label": "Small font", "description": "Use a smaller font size (90%)", "example": "yes", "type": "boolean", "default": "no" } } } </templatedata> |Div col end=<templatedata> {
"description": "Ends a multi-column list started by
}}{{#ifeq: |yes
|}}. It takes no parameters.", "params": { }
} </templatedata> }}
Redirects
{{#ifeq:Div col|Div col|
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:Div col start|Div col start]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:Div col begin|Div col begin]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:Colbegin|Colbegin]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} (but not {{[[{{#if:|{{{SISTER}}}Template|Template}}:Col begin|Col begin]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}})
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:Cols|Cols]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
}} {{#ifeq:Div col|Div col end|
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:Col div end|Col div end]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:Colend|Colend]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} (but not {{[[{{#if:|{{{SISTER}}}Template|Template}}:Col end|Col end]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}})
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:Div end|Div end]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:Divcol-end|Divcol-end]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:Divcolend|Divcolend]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:Divend|Divend]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:End div col|End div col]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
- {{[[{{#if:|{{{SISTER}}}Template|Template}}:EndDivCol|EndDivCol]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}
}}
See also
Column-generating template families
{{#invoke:Message box|mbox}} <section begin="table" />
Family | Type | Handles wiki {{#if:|}}
table code?main}} |
Start template | Column divider | End template |
---|---|---|---|---|---|
"Col" | Table | style="text-align:center;" | {{[[{{#if:|{{{SISTER}}}Template|Template}}:Col-begin|Col-begin]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} or {{[[{{#if:|{{{SISTER}}}Template|Template}}:Col-begin-small|Col-begin-small]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} |
{{[[{{#if:|{{{SISTER}}}Template|Template}}:Col-break|Col-break]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} {{[[{{#if:|{{{SISTER}}}Template|Template}}:Col-2|Col-2]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} .. {{[[{{#if:|{{{SISTER}}}Template|Template}}:Col-5|Col-5]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} |
{{[[{{#if:|{{{SISTER}}}Template|Template}}:Col-end|Col-end]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} |
"Columns" | Table | No | {{[[{{#if:|{{{SISTER}}}Template|Template}}:Columns|Columns]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} | – | – |
"Col-float" | CSS float | style="text-align:center;" | {{[[{{#if:|{{{SISTER}}}Template|Template}}:Col-float|Col-float]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} | {{[[{{#if:|{{{SISTER}}}Template|Template}}:Col-float-break|Col-float-break]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} | {{[[{{#if:|{{{SISTER}}}Template|Template}}:Col-float-end|Col-float-end]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} |
"Columns-start" | CSS float | style="text-align:center;" | {{[[{{#if:|{{{SISTER}}}Template|Template}}:Columns-start|Columns-start]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} | {{[[{{#if:|{{{SISTER}}}Template|Template}}:Column|Column]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} | {{[[{{#if:|{{{SISTER}}}Template|Template}}:Columns-end|Columns-end]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} |
"Div col" | CSS columns | style="text-align:center;" | {{[[{{#if:|{{{SISTER}}}Template|Template}}:Div col|Div col]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} – {{[[{{#if:|{{{SISTER}}}Template|Template}}:Columns-list|Columns-list]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} (wrapper) |
– | {{[[{{#if:|{{{SISTER}}}Template|Template}}:Div col end|Div col end]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} |
main}} I.e., can the columns handle the wiki markup {| | || |- |} used to create tables? If not, templates that produce these elements (such as {{[[{{#if:|{{{SISTER}}}Template|Template}}:(!|(!]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}, {{[[{{#if:|{{{SISTER}}}Template|Template}}:!|!]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}, {{[[{{#if:|{{{SISTER}}}Template|Template}}:!!|!!]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}, {{[[{{#if:|{{{SISTER}}}Template|Template}}:!-|!-]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}, {{[[{{#if:|{{{SISTER}}}Template|Template}}:!)|!)]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}}) and/or HTML tags ({{#switch:pair
|c|close = |e|empty|s|single|v|void |o|open |p|pair = <table{{#if:| {{{params}}}}} }}{{#switch:pair |c|close = |e|empty|s|single|v|void = /> |o|open = > |p|pair = {{#ifeq:table|!--||>}}... }}{{#switch:pair |e|empty|s|single|v|void |o|open = |c|close |p|pair = {{#ifeq:table|!--|-->|</table>}} }}
,{{#switch:pair |c|close = |e|empty|s|single|v|void |o|open |p|pair = <tr{{#if:| {{{params}}}}} }}{{#switch:pair |c|close = |e|empty|s|single|v|void = /> |o|open = > |p|pair = {{#ifeq:tr|!--||>}}... }}{{#switch:pair |e|empty|s|single|v|void |o|open = |c|close |p|pair = {{#ifeq:tr|!--|-->|</tr>}} }}
, etc.) will need to be used instead.<section end="table" />