Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:Div-col/doc.
Not to be confused with {{Col-begin}}, {{Cols}}, or {{Div col}}.
  • Wikipedia: Template:CSS3 multiple column layout
  • {{Div-col}}, together with {{Div-col-break}} and {{Div-col-end}}, is used to make a list into columns. It automatically breaks each column into an equal space, and you can put manually break point between two columns. The template also offers options to set a smaller (90%) font-size (|small=yes), place gaps between the columns (|gap=) and to add other custom styling (|style=).

    {{Div-col}} can create multiple columns in web browsers which support the following CSS properties:

    • display: grid Set the contents as grid-based layout, makes them possible to become columns.
    • grid-template-columns Set the number of columns and their width (for CSS3-compliant browsers; see CSS Grid Layout Module)
    • grid-column-gap Set the gap between the columns

    Usage

    edit
     |cols= or first unnamed parameter – Specifies the number of columns (default 2).
    |colwidth= or second unnamed parameter – Specifies the width of the columns (default 1fr).
    |gap= – Specifies the space between the content of adjacent columns. The default spacing is 1em.
    |style= – CSS styling to apply to the columns.

    Examples

    edit
    {{Div-col}}
    * a
    * b
    * c
    * d
    {{Div-col-break}}
    * e
    * f
    * g
    * h
    {{Div-col-end}}
    
    produces
    • a
    • b
    • c
    • d
    • e
    • f
    • g
    • h
    {{Div-col|3}}
    * a
    * b
    * c
    {{Div-col-break}}
    * d
    * e
    * f
    {{Div-col-break}}
    * g
    * h
    {{Div-col-end}}
    
    produces
    • a
    • b
    • c
    • d
    • e
    • f
    • g
    • h
    {{Div-col|colwidth=10em}}
    * a
    * b
    * c
    * d
    {{Div-col-break}}
    * e
    * f
    * g
    * h
    {{Div-col-end}}
    
    produces
    • a
    • b
    • c
    • d
    • e
    • f
    • g
    • h
    {{Div-col|small=yes}}
    * a
    * b
    * c
    * d
    {{Div-col-break}}
    * e
    * f
    * g
    * h
    {{Div-col-end}}
    
    produces
    • a
    • b
    • c
    • d
    • e
    • f
    • g
    • h

    TemplateData

    edit
    <templatedata>JSON</templatedata> ./. {{TemplateBox}}
    TemplateData

    TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


    Existing template documentation
    At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

    Newly created template documentation and imports
    Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


    Wikipedia's help about TemplateDataCommons-specific information

    Breaks a list into columns. It automatically breaks each column to an equal width, so you can try to manually put a break point on two columns. The list is broke with {{div-col-break}} and closed with {{div-col-end}}.

    Template parameters[Edit template data]

    ParameterDescriptionTypeStatus
    colscols 1

    Specifies the number of columns.

    Default
    2
    Stringoptional
    colwidthcolwidth 2

    By default, it 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 is allowed to set fixed width to the columns.

    Default
    1fr
    Stringoptional
    gapgap

    Specifies the space between the content of adjacent columns.

    Stringoptional
    stylestyle

    Specifies any custom styling.

    Stringoptional

    See also

    edit