Jump to content

Template:Columns-list/doc: Difference between revisions

From pool
[checked revision][checked revision]
Content deleted Content added
Created page with "{{Documentation subpage}} {{Lua|Module:Check for unknown parameters}} {{Commons Import}} For documentation see wikipedia page wikipedia:Template:Columns-list"
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AT THE END OF THIS PAGE -->
{{Hatnote|{{tl|Collist}} redirects here. You may be looking for {{tl|Collapsible list}}.}}
{{Tsh|cmn|collist|col-list}}
{{Lua|Module:Check for unknown parameters}}
{{Lua|Module:Check for unknown parameters}}
{{Commons Import}}
{{Commons Import}}


This template is for use in a list in the body of an article, rather than in a navigation template like [[Template:Navbox]]. Based on [[Template:Reflist]], but different in that the text to be displayed is manually created rather than a list of references.


== Use ==
For documentation see wikipedia page [[wikipedia:Template:Columns-list]]
The width of each column may be specified using {{para|colwidth}} and a value in ems.
<nowiki>{{</nowiki>columns-list|colwidth=''width''|
''Text (usually a list)''
<nowiki>}}</nowiki>
Here, ''width'' specifies the width of the columns, and determines dynamically the number of columns based on screen width; more columns will be shown on wider displays.

If {{para|colwidth}} is not specified, the default width of 30em will be used.

This template uses [[Wikipedia:CSS|CSS]]3 multiple-column layout, which is not supported by all [[Wikipedia:WWW|Web]] [[Wikipedia:Web&nbsp;browser|browsers]].

{{CSS3 multiple column layout}}

=== Examples ===
Here is an example:
<syntaxhighlight lang=text>{{columns-list|colwidth=35em|
* [[Wikipedia:George Washington|]]
* [[Wikipedia:John Adams|]]
* [[Wikipedia:Thomas Jefferson|]]
* [[Wikipedia:James Madison|]]
* [[Wikipedia:James Monroe|]]
}}</syntaxhighlight>

which would render as:
{{clear}}<!-- just in case {{CSS3 multiple column layout}} pokes down this far -->
{{columns-list|colwidth=35em|
* [[Wikipedia:George Washington|George Washington]]
* [[Wikipedia:John Adams|John Adams]]
* [[Wikipedia:Thomas Jefferson|Thomas Jefferson]]
* [[Wikipedia:James Madison|James Madison]]
* [[Wikipedia:James Monroe|James Monroe]]
}}

[[Wikipedia:CSS|CSS]] styles can also be added with the {{para|style}} parameter. For example:

<syntaxhighlight lang=text>{{columns-list|colwidth=15em|style=width: 600px; font-style: italic;|
* [[Wikipedia:All About Lily Chou-Chou|]]
* [[Wikipedia:April Story|]]
* [[Wikipedia:Hana and Alice|Hana & Alice|]]
* [[Wikipedia:Hōtai Club|]]
* [[Wikipedia:The Kon Ichikawa Story|]]
* [[Wikipedia:Love Letter (1995 film)|Love Letter|]]
* [[Wikipedia:New York, I Love You|]]
* [[Wikipedia:Picnic (1996 film)|Picnic|]]
* [[Wikipedia:Rainbow Song|]]
* [[Wikipedia:Swallowtail (film)|Swallowtail|]]
}}</syntaxhighlight>

which would render as:
{{columns-list|colwidth=15em|style=width: 600px; font-style: italic;|
* [[Wikipedia:All About Lily Chou-Chou|All About Lily Chou-Chou]]
* [[Wikipedia:April Story|April Story]]
* [[Wikipedia:Hana and Alice|Hana & Alice|]]
* [[Wikipedia:Hōtai Club|Hōtai Club]]
* [[Wikipedia:The Kon Ichikawa Story|The Kon Ichikawa Story]]
* [[Wikipedia:Love Letter (1995 film)|Love Letter|]]
* [[Wikipedia:New York, I Love You|New York]]
* [[Wikipedia:Picnic (1996 film)|Picnic|]]
* [[Wikipedia:Rainbow Song|Rainbow Song]]
* [[Wikipedia:Swallowtail (film)|Swallowtail|]]
}}

This template also works with numbered lists as its "text". For example:

<syntaxhighlight lang=text>
{{columns-list|colwidth=35em|
# [[Wikipedia:George Washington|]]
# [[Wikipedia:John Adams|]]
# [[Wikipedia:Thomas Jefferson|]]
# [[Wikipedia:James Madison|]]
# [[Wikipedia:James Monroe|]]
}}
</syntaxhighlight>

{{columns-list|colwidth=35em|
# [[Wikipedia:George Washington|George Washington]]
# [[Wikipedia:John Adams|John Adams]]
# [[Wikipedia:Thomas Jefferson|Thomas Jefferson]]
# [[Wikipedia:James Madison|James Madison]]
# [[Wikipedia:James Monroe|James Monroe]]
}}

The template, in fact, works with ''everything'' since all it does is wrap the text provided around a block to be divided into columns by CSS. Do not stop at wikitext lists &ndash; more advanced lists generated by [[Wikipedia:Template:HTML lists|the HTML templates|]] will work too!

==Error messages==
Use of the no-longer-supported parameter {{para|cols}}, or use of the first unnamed parameter (aka {{para|1}}) along with {{para|2}} or a second unnamed parameter for the template's content, will generate a red error message. To fix this error, use {{para|colwidth}} instead of attempting to specify the number of columns.

The presence of an equals sign within the template's content can also cause display problems and red error messages. To fix this problem, add {{para|1}} in front of the template's content.

== Redirects ==
* {{tl|cmn}}
* {{tl|collist}}
* {{tl|col-list}}
* {{tl|Columnslist}}

== Tracking category ==
* {{clc|Pages using columns-list with unknown parameters}} (for pages in article space only)

== See also ==
{{Column-generating template families}}
{{HTML lists}}
<!-- == References ==
{{Reflist}} -->

<includeonly>{{Sandbox other||

<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Multi-column templates]]
[[Category:List formatting and function templates]]
[[Category:Templates that add a tracking category]]
}}</includeonly>

Latest revision as of 22:24, 12 November 2020


This template is for use in a list in the body of an article, rather than in a navigation template like Template:Navbox. Based on Template:Reflist, but different in that the text to be displayed is manually created rather than a list of references.

Use

The width of each column may be specified using |colwidth= and a value in ems.

{{columns-list|colwidth=width|
Text (usually a list)
}}

Here, width specifies the width of the columns, and determines dynamically the number of columns based on screen width; more columns will be shown on wider displays.

If |colwidth= is not specified, the default width of 30em will be used.

This template uses CSS3 multiple-column layout, which is not supported by all Web browsers.

CSS3 multiple-column layout browser support
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)

Examples

Here is an example:

{{columns-list|colwidth=35em|
* [[Wikipedia:George Washington|]]
* [[Wikipedia:John Adams|]]
* [[Wikipedia:Thomas Jefferson|]]
* [[Wikipedia:James Madison|]]
* [[Wikipedia:James Monroe|]]
}}

which would render as:

CSS styles can also be added with the |style= parameter. For example:

{{columns-list|colwidth=15em|style=width: 600px; font-style: italic;|
* [[Wikipedia:All About Lily Chou-Chou|]]
* [[Wikipedia:April Story|]]
* [[Wikipedia:Hana and Alice|Hana & Alice|]]
* [[Wikipedia:Hōtai Club|]]
* [[Wikipedia:The Kon Ichikawa Story|]]
* [[Wikipedia:Love Letter (1995 film)|Love Letter|]]
* [[Wikipedia:New York, I Love You|]]
* [[Wikipedia:Picnic (1996 film)|Picnic|]]
* [[Wikipedia:Rainbow Song|]]
* [[Wikipedia:Swallowtail (film)|Swallowtail|]]
}}

which would render as:

This template also works with numbered lists as its "text". For example:

{{columns-list|colwidth=35em|
# [[Wikipedia:George Washington|]]
# [[Wikipedia:John Adams|]]
# [[Wikipedia:Thomas Jefferson|]]
# [[Wikipedia:James Madison|]]
# [[Wikipedia:James Monroe|]]
}}

The template, in fact, works with everything since all it does is wrap the text provided around a block to be divided into columns by CSS. Do not stop at wikitext lists – more advanced lists generated by the HTML templates| will work too!

Error messages

Use of the no-longer-supported parameter |cols=, or use of the first unnamed parameter (aka |1=) along with |2= or a second unnamed parameter for the template's content, will generate a red error message. To fix this error, use |colwidth= instead of attempting to specify the number of columns.

The presence of an equals sign within the template's content can also cause display problems and red error messages. To fix this problem, add |1= in front of the template's content.

Redirects

Tracking category

See also

Column-generating template families

Family Type
Handles wiki
 table code?dagger
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}}

dagger 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.