Difference between revisions of "Template:Div col/doc"
(→not Usage: all data) |
imported>Shellwood m (Reverted edits by 123.108.244.186 (talk) (HG) (3.4.4)) |
||
| Line 1: | Line 1: | ||
| − | <!---------------------------------------------------------------------------- | + | <!----------------------------------------------------------------------------- |
PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE | PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE | ||
------------------------------------------------------------------------------> | ------------------------------------------------------------------------------> | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
| − | {{ | + | {{High-risk| 158000+ }} |
| − | {{Ombox |type=notice |text=Columns are supported by some older browsers, most | + | {{Ombox |type=notice |text=Columns are not supported by some older browsers, most notably Internet Explorer 9 and below and Opera 11.0 and below. See [[Template:Reflist#Browser support for columns|this page]] for more information.}} |
{{CSS3 multiple column layout}} | {{CSS3 multiple column layout}} | ||
| − | {{tl|Div col}} can be used to make a list into columns that wrap properly and compatibly with | + | {{tl|Div col}} 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 and two-thirds points between two columns. |
| − | The list content is either | + | * The list content is either provided by the {{para|content}} parameter (which can be restrictive of what content is allowed; e.g., wiki markup like {{!}} must somehow be escaped), or terminated with {{tl|div col end}}. The {{tl|columns-list}} wrapper uses the parameter method for providing content (including its limitations). |
| − | * The template system (family) also | + | * The template system (family) also offers parameter options to set a smaller (90%) font-size parameter ({{para|small|yes}}), place vertical lines parameter ("rules") between the columns ({{para|rules}}) and to add other custom styling ({{para|style}}). |
| − | {{tl|Div col}} can create multiple columns in [[web browser]]s which | + | {{tl|Div col}} can create multiple columns in [[web browser]]s which support the following [[CSS]] properties: |
| − | * ''column-width'' (for [[Cascading Style Sheets#CSS 3|CSS3]]- | + | * ''column-width'' (for [[Cascading Style Sheets#CSS 3|CSS3]]-compliant browsers; see [http://www.w3.org/TR/css3-multicol/ CSS3 module: Multi-column layout]) |
By default, the template creates columns that are 30em wide. | By default, the template creates columns that are 30em wide. | ||
| − | == | + | ==Usage== |
There are five parameters for this template; their usage is described below. | There are five parameters for this template; their usage is described below. | ||
| − | ; {{para|colwidth}} : Specifies the minimum width of the columns and determines | + | ; {{para|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). Can be specified in any CSS unit, for instance in [[Em (typography)|em]], about the width of a capital "M", e.g., <code>colwidth=20em</code>. If no value is supplied, the template uses a default of 30em. |
| − | ; {{para|rules}} : | + | ; {{para|rules}} : Adds vertical lines ("rules") between the columns if set to <code>yes</code> or some CSS styling (e.g. <code>1px dashed blue;</code>). |
| − | ; {{para|gap}} : Specifies the space between the | + | ; {{para|gap}} : Specifies the space between the content of adjacent columns. Specified in any CSS unit, e.g, <code>gap=2em</code>. The default spacing (set by browser) is 1em. |
| − | ; {{para|style}} : [[Cascading Style Sheets|CSS styling]] to | + | ; {{para|style}} : [[Cascading Style Sheets|CSS styling]] to apply to the columns. |
| − | ; {{para|content}} : content to | + | ; {{para|content}} : content to apply to the columns. |
==Examples== | ==Examples== | ||
| − | === | + | ===Usage of "colwidth" parameter=== |
; Example with column width of 10em | ; Example with column width of 10em | ||
<pre> | <pre> | ||
| Line 38: | Line 38: | ||
* g | * g | ||
* h | * h | ||
| − | {{div col | + | {{div col end}} |
</pre> | </pre> | ||
; produces: | ; produces: | ||
| Line 52: | Line 52: | ||
{{Div col end}} | {{Div col end}} | ||
| − | ===Usage of " | + | ===Usage of "rules" parameter=== |
; Example: | ; Example: | ||
<pre> | <pre> | ||
| Line 64: | Line 64: | ||
* g | * g | ||
* h | * h | ||
| − | {{Div col | + | {{Div col end}} |
</pre> | </pre> | ||
; produces: | ; produces: | ||
| Line 76: | Line 76: | ||
* g | * g | ||
* h | * h | ||
| − | {{Div col | + | {{Div col end}} |
===Usage of "gap" parameter=== | ===Usage of "gap" parameter=== | ||
| − | Example: | + | ; Example: |
<pre> | <pre> | ||
| − | {{ | + | {{Div col|colwidth=10em|rules=yes|gap=2em}} |
* a | * a | ||
* b | * b | ||
| Line 90: | Line 90: | ||
* g | * g | ||
* h | * h | ||
| − | {{Div col | + | {{Div col end}} |
</pre> | </pre> | ||
; produces: | ; produces: | ||
| Line 105: | Line 105: | ||
===Usage of "small" parameter=== | ===Usage of "small" parameter=== | ||
| − | ; Example showing how setting "small" parameter to " | + | ; Example showing how setting "small" parameter to "yes" produces smaller font size |
<pre> | <pre> | ||
{{Div col|small=yes}} | {{Div col|small=yes}} | ||
| Line 116: | Line 116: | ||
* g | * g | ||
* h | * h | ||
| − | {{Div col | + | {{Div col end}} |
</pre> | </pre> | ||
; produces: | ; produces: | ||
| Line 130: | Line 130: | ||
{{Div col end}} | {{Div col end}} | ||
| − | ===Usage of " | + | ===Usage of "content" parameter=== |
; Example showing how to provide "content" parameter without using {{tlx|Div col end}} | ; Example showing how to provide "content" parameter without using {{tlx|Div col end}} | ||
<pre> | <pre> | ||
| Line 145: | Line 145: | ||
</pre> | </pre> | ||
; produces: | ; produces: | ||
| − | {{ | + | {{Div col|colwidth=10em|content= |
* a | * a | ||
* b | * b | ||
| Line 156: | Line 156: | ||
}} | }} | ||
| − | ===Usage with | + | ===Usage with multiple parameters=== |
Parameters can be used in any order. | Parameters can be used in any order. | ||
'''Example: ''' | '''Example: ''' | ||
<pre> | <pre> | ||
| − | {{ | + | {{Div col|colwidth=10em|rules=yes|gap=2em|small=yes}} |
* a | * a | ||
* b | * b | ||
| Line 169: | Line 169: | ||
* g | * g | ||
* h | * h | ||
| − | {{Div col | + | {{Div col end}} |
</pre> | </pre> | ||
or | or | ||
<pre> | <pre> | ||
| − | {{Div col|rules= | + | {{Div col|rules=yes|gap=2em|small=yes|colwidth=10em}} |
* a | * a | ||
* b | * b | ||
| Line 182: | Line 182: | ||
* g | * g | ||
* h | * h | ||
| − | {{Div col | + | {{Div col end}} |
</pre> | </pre> | ||
| − | produces: | + | ; produces: |
| − | {{ | + | {{Div col|colwidth=10em|rules=yes|gap=2em|small=yes}} |
* a | * a | ||
* b | * b | ||
| Line 194: | Line 194: | ||
* g | * g | ||
* h | * h | ||
| − | {{Div col | + | {{Div col end}} |
| − | and exactly the | + | and exactly the same result below |
| − | {{Div col|rules= | + | {{Div col|rules=yes|gap=2em|small=yes|colwidth=10em}} |
* a | * a | ||
* b | * b | ||
| Line 205: | Line 205: | ||
* g | * g | ||
* h | * h | ||
| − | {{Div col | + | {{Div col end}} |
; Example with column width of 20em | ; Example with column width of 20em | ||
| Line 218: | Line 218: | ||
* g | * g | ||
* h | * h | ||
| − | {{div col | + | {{div col end}} |
</pre> | </pre> | ||
| − | produces: | + | ; produces: |
| − | {{ | + | {{Div col|colwidth=20em}} |
* a | * a | ||
* b | * b | ||
| Line 230: | Line 230: | ||
* g | * g | ||
* h | * h | ||
| − | {{Div col | + | {{Div col end}} |
| − | + | ; Example with column width of 30em | |
<pre> | <pre> | ||
{{div col|colwidth=30em}} | {{div col|colwidth=30em}} | ||
| Line 243: | Line 243: | ||
* g | * g | ||
* h | * h | ||
| − | {{div col | + | {{div col end}} |
</pre> | </pre> | ||
; produces: | ; produces: | ||
| − | {{ | + | {{Div col|colwidth=30em}} |
* a | * a | ||
* b | * b | ||
| Line 255: | Line 255: | ||
* g | * g | ||
* h | * h | ||
| − | {{Div col | + | {{Div col end}} |
| − | + | ; Example of how this template behaves if no [[•|bullets]] (generated by asterisk mark) are used. | |
<pre> | <pre> | ||
| − | {{ | + | {{div col|colwidth=10em}} |
a | a | ||
b | b | ||
| Line 268: | Line 268: | ||
g | g | ||
h | h | ||
| − | {{div col | + | {{div col end}} |
</pre> | </pre> | ||
; produces: | ; produces: | ||
| − | {{Div col| | + | {{Div col|colwidth=10em}} |
a | a | ||
b | b | ||
| Line 280: | Line 280: | ||
g | g | ||
h | h | ||
| − | {{Div col | + | {{Div col end}} |
==Tracking categories== | ==Tracking categories== | ||
| − | {{clc|Pages using div col with | + | *{{clc|Pages using div col with unknown parameters}} (for erroneous use of parameter names not documented here) |
==TemplateData== | ==TemplateData== | ||
| − | {{ | + | {{TemplateDataHeader}} |
| − | { | + | {{#switch: {{BASEPAGENAME}} |
| − | |Div col=< | + | |Div col=<templatedata> |
{ | { | ||
| − | "description": " | + | "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 {{div col end}}.", |
"params": { | "params": { | ||
"cols": { | "cols": { | ||
| Line 296: | Line 296: | ||
"description": "Specifies the number of columns.", | "description": "Specifies the number of columns.", | ||
"type": "number", | "type": "number", | ||
| − | " | + | "default": "2", |
"aliases": [ | "aliases": [ | ||
| − | " | + | "1" |
], | ], | ||
| − | "required": | + | "required": false, |
| − | "deprecated": " | + | "deprecated": "Use colwidth parameter instead, so that the layout resizes according to the screen" |
}, | }, | ||
"colwidth": { | "colwidth": { | ||
| − | "label": "Column | + | "label": "Column width", |
| − | "description": " | + | "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": " | + | "type": "string", |
"aliases": [ | "aliases": [ | ||
| − | " | + | "2" |
], | ], | ||
| − | "required": | + | "required": false, |
| − | " | + | "example": "30em", |
| − | "suggested": | + | "suggested": true |
}, | }, | ||
"rules": { | "rules": { | ||
| − | "label": " | + | "label": "Rules", |
"description": "Produces vertical rules between the columns if set to yes.", | "description": "Produces vertical rules between the columns if set to yes.", | ||
| − | "type": " | + | "type": "string", |
| − | "required": | + | "required": false, |
| − | "example": "' | + | "example": "'yes' or '1px dashed blue'" |
}, | }, | ||
"gap": { | "gap": { | ||
| − | " | + | "label": "Gap size", |
| − | "description": "Specifies the space between the | + | "description": "Specifies the space between the content of adjacent columns.", |
| − | "type": " | + | "type": "string", |
| − | "required": | + | "required": false, |
| − | " | + | "example": "2em" |
}, | }, | ||
| − | " | + | "style": { |
| − | " | + | "label": "CSS style", |
| − | "description": " | + | "description": "Specifies any custom styling.", |
| − | "type": " | + | "type": "string", |
| − | "required": | + | "required": false |
}, | }, | ||
"content": { | "content": { | ||
| − | "label": " | + | "label": "Content", |
| − | "description": " | + | "description": "Specifies the content to divide into columns", |
| − | "type": " | + | "type": "string", |
| − | " | + | "required": false |
}, | }, | ||
"small": { | "small": { | ||
| − | " | + | "label": "Small font", |
| − | " | + | "description": "Use a smaller font size (90%)", |
| − | "example": " | + | "example": "yes", |
| − | "type": " | + | "type": "boolean", |
| − | " | + | "default": "no" |
} | } | ||
} | } | ||
} | } | ||
| − | </ | + | </templatedata> |
| − | |Div col | + | |Div col end=<templatedata> |
{ | { | ||
| − | "description": " | + | "description": "Ends a multi-column list started by {{div col}}. It takes no parameters.", |
"params": { | "params": { | ||
} | } | ||
} | } | ||
| − | </ | + | </templatedata> |
}} | }} | ||
| − | == | + | ==Redirects== |
| − | {{#ifeq:{{ROOTPAGENAME}}| | + | {{#ifeq:{{ROOTPAGENAME}}|Div col| |
| − | * {{Tlx| | + | * {{Tlx|Col div}} |
| − | * {{Tlx| | + | * {{Tlx|Colbegin}} (but '''not''' {{Tlx|Col begin}} or {{Tlx|Col-begin}}) |
| − | * {{Tlx| | + | * {{Tlx|Cols}} |
| − | * {{Tlx|Div col | + | * {{Tlx|Div col start}} |
| − | * {{Tlx|Div col | + | * {{Tlx|Div col begin}} |
| − | * {{Tlx| | + | * {{Tlx|Div-col}} |
| − | * {{Tlx|Palmares | + | * {{Tlx|Palmares start}} |
}} | }} | ||
| − | {{#ifeq:{{ROOTPAGENAME}}|Div col | + | {{#ifeq:{{ROOTPAGENAME}}|Div col end| |
| − | *{{Tlx|Col div | + | *{{Tlx|Col div end}} |
| − | *{{Tlx| | + | *{{Tlx|Colend}} (but '''not''' {{Tlx|Col end}}) |
| − | *{{Tlx| | + | *{{Tlx|Div end}} |
| − | *{{Tlx| | + | *{{Tlx|Divcol-end}} |
| − | *{{Tlx| | + | *{{Tlx|Divcolend}} |
| − | *{{Tlx| | + | *{{Tlx|Divend}} |
| − | *{{Tlx| | + | *{{Tlx|End div col}} |
| − | *{{Tlx| | + | *{{Tlx|EndDivCol}} |
}} | }} | ||
==See also== | ==See also== | ||
| − | {{Column- | + | {{Column-generating template families}} |
| − | < | + | <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
| <!-- CATEGORIES BELOW THIS LINE, PLEASE: --> | | <!-- CATEGORIES BELOW THIS LINE, PLEASE: --> | ||
[[Category:Multi-column templates]] | [[Category:Multi-column templates]] | ||
| − | <!--?:-->{{#switch:{{PAGENAME}} |Div col= |Div col}} | + | <!--?:-->{{#switch:{{PAGENAME}} |Div col= |Div col end=}} |
[[es:Plantilla:Div col]] | [[es:Plantilla:Div col]] | ||
| − | }}</ | + | }}</includeonly> |
Revision as of 05:42, 8 September 2018
| This is a documentation subpage for Template:Div col. It contains usage information, categories and other content that is not part of the original template page. |
| This template is used on 314,000+ pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. Transclusion count updated automatically (see documentation). |
| Columns are not supported by some older browsers, most notably Internet Explorer 9 and below and Opera 11.0 and below. See this page for more information. |
| Property | Internet Explorer |
Firefox | Safari | Chrome | Opera |
|---|---|---|---|---|---|
| column-width column-count |
≥ 10 (2012) |
≥ 1.5 (2005) |
≥ 3 (2007) |
≥ 1 (2008) |
≥ 11.1 (2011) |
| columns | ≥ 10 (2012) |
≥ 9 (2011) |
≥ 3 (2007) |
≥ 1 (2008) |
≥ 11.1 (2011) |
| break-before break-after break-inside |
≥ 10 (2012) |
≥ 65 (2019) |
≥ 10 (2016) |
≥ 65 (2016) |
≥ 15 (2013) |
{{Div col}} 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 and two-thirds points between two columns.
- The list content is either provided by the
|content=parameter (which can be restrictive of what content is allowed; e.g., wiki markup like | must somehow be escaped), or terminated with {{div col end}}. The {{columns-list}} 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 (
|small=yes), place vertical lines parameter ("rules") between the columns (|rules=) and to add other custom styling (|style=).
{{Div col}} can create multiple columns in web browsers which support the following CSS properties:
- column-width (for CSS3-compliant browsers; see CSS3 module: Multi-column layout)
By default, the template creates columns that are 30em wide.
Usage
There are five parameters for this template; their usage is described below.
|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). Can be specified in any CSS unit, for instance in em, about the width of a capital "M", e.g.,
colwidth=20em. If no value is supplied, the template uses a default of 30em. |rules=- Adds vertical lines ("rules") between the columns if set to
yesor some CSS styling (e.g.1px dashed blue;). |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. |style=- CSS styling to apply to the columns.
|content=- content to apply to the columns.
Examples
Usage of "colwidth" parameter
- Example with column width of 10em
{{div col|colwidth=10em}}
* a
* b
* c
* d
* e
* f
* g
* h
{{div col end}}
- produces
- 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
- 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
- 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
- a
- b
- c
- d
- e
- f
- g
- h
Usage of "content" parameter
- Example showing how to provide "content" parameter without using
{{Div col end}}
{{Div col|colwidth=10em|content=
* a
* b
* c
* d
* e
* f
* g
* h
}}
- produces
- a
- b
- c
- d
- e
- f
- g
- h
Usage with multiple parameters
Parameters 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
- a
- b
- c
- d
- e
- f
- g
- h
and exactly the same result below
- a
- b
- c
- d
- e
- f
- g
- h
- Example with column width of 20em
{{div col|colwidth=20em}}
* a
* b
* c
* d
* e
* f
* g
* h
{{div col end}}
- produces
- a
- b
- c
- d
- e
- f
- g
- h
- Example with column width of 30em
{{div col|colwidth=30em}}
* a
* b
* c
* d
* e
* f
* g
* h
{{div col end}}
- produces
- 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|colwidth=10em}}
a
b
c
d
e
f
g
h
{{div col end}}
- produces
a b c d e f g h
Tracking categories
- Category:Pages using div col with unknown parameters (0) (for erroneous use of parameter names not documented here)
TemplateData
TemplateData for Div col
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 {{div col end}}.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| cols | cols 1 | Specifies the number of columns.
| Number | deprecated |
| Column width | colwidth 2 | 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.
| String | suggested |
| Rules | rules | Produces vertical rules between the columns if set to yes.
| String | optional |
| Gap size | gap | Specifies the space between the content of adjacent columns.
| String | optional |
| CSS style | style | Specifies any custom styling. | String | optional |
| Content | content | Specifies the content to divide into columns | String | optional |
| Small font | small | Use a smaller font size (90%)
| Boolean | optional |
Redirects
{{Col div}}{{Colbegin}}(but not{{Col begin}}or{{Col-begin}}){{Cols}}{{Div col start}}{{Div col begin}}{{Div-col}}{{Palmares start}}
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" />
| Family | Type | Handles wiki
table code? |
Responsive/ Mobile suited |
Start template | Column divider | End template |
|---|---|---|---|---|---|---|
| "Col" | Table | Yes | Yes | {{Col-begin}}, {{Col-begin-fixed}} or {{Col-begin-small}} |
{{Col-break}} or {{Col-2}} .. {{Col-5}} |
{{Col-end}} |
| "Col-float" | CSS float | Yes | Yes | {{Col-float}} | {{Col-float-break}} | {{Col-float-end}} |
| "Columns" | Table | No | Yes | {{Columns}} | – | – |
| "Columns-list" | CSS columns | Yes | Yes | {{Columns-list}} (wrapper) | – | – |
| "Columns-start" | CSS float | Yes | Yes | {{Columns-start}} | {{Column}} | {{Columns-end}} |
| "Flex columns" | CSS flexbox | Yes | Yes | {{Flex columns}} | – | – |
| "Div col" | CSS columns | Yes | Yes | {{Div col}} | – | {{Div col end}} |
I.e., can the columns handle the wiki markup {| | || |- |} used to create tables? If not, templates that produce these elements (such as {{(!}}, {{!}}, {{!!}}, {{!-}}, {{!)}}) or HTML tags (<table>...</table>, <tr>...</tr>, etc.) will need to be used instead.<section end="table" />