Misplaced Pages

Template:Div col/doc: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< Template:Div col Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 14:20, 2 January 2015 editSardanaphalus (talk | contribs)119,752 editsm top: caps, removed parentheses, surplus link← Previous edit Revision as of 16:16, 2 January 2015 edit undoEdokter (talk | contribs)Extended confirmed users55,830 editsm Reverted edits by Sardanaphalus (talk) to last version by EdokterNext edit →
Line 6: Line 6:
{{CSS3 multiple column layout}} {{CSS3 multiple column layout}}


{{tl|Div col}} or {{tl|Start div col}}, together with {{tl|Div col end}} or {{tl|End div col}}, is used to make a list into columns. It automatically breaks each column into an equal space, meaning, for instance, it isn't necessary to work out the halfway point between two columns. The template also offers options to set a smaller (90%) font-size ({{para|small|yes}}), place vertical lines ("rules") between the columns ({{para|rules}}) and to add other custom styling ({{para|style}}). {{tl|Div col}}, together with {{tl|div col end}}, is used to make a list into columns. It automatically breaks each column into an equal space, meaning, for instance, it isn't necessary to work out the halfway point between two columns. The template also offers options to set a smaller (90%) font-size ({{para|small|yes}}), place vertical lines ("rules") between the columns ({{para|rules}}) and to add other custom styling ({{para|style}}).


{{tnf|Div col}} can create multiple columns in ]s which support one of the following ] properties: {{tl|Div col}} can create multiple columns in ]s which support one of the following ] properties:
* ''column-count'' (for ] compliant browsers; see ) * ''column-count'' (for ] compliant browsers; see )
* ''-moz-column-count'' (for ]/] based browsers such as ]) * ''-moz-column-count'' (for ]/] based browsers such as ])
* ''-webkit-column-count'' (for ] based browsers such as ] and ]) * ''-webkit-column-count'' (for ] based browsers such as ] and ])


===Usage=== ==Usage==
; {{s|{{para|cols}}}} {{nobold|or first unnamed parameter}} : ''(Now ], as ''colwidth'' below is better suited to flexible formatting for a variety of display screen sizes (from mobile phones, tablets, etc to widescreen cinema-style displays))''<br/>Specifies the number of columns (default 2). ; {{s|{{para|cols}}}} {{nobold|or first unnamed parameter}} : ''(Now ], as ''colwidth'' below is better suited to flexible formatting for a variety of display screen sizes (from mobile phones, tablets, etc to widescreen cinema-style displays))''<br/>Specifies the number of columns (default 2).
; {{para|colwidth}} {{nobold|or second unnamed parameter}} : 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''. ; {{para|colwidth}} {{nobold|or second unnamed parameter}} : 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''.
Line 20: Line 20:
; {{para|style}} : CSS styling to apply to the columns. ; {{para|style}} : CSS styling to apply to the columns.


===Examples=== ==Examples==
<pre> <pre>
{{Div col}} {{Div col}}
* a * a
* b * b
Line 31: Line 31:
* g * g
* h * h
{{Div col end}} {{Div col end}}
</pre> </pre>
; produces: ; produces:
Line 141: Line 141:
{{Div col end}} {{Div col end}}


===TemplateData=== ==TemplateData==
{{TemplateDataHeader}} {{TemplateDataHeader}}
{{#switch: {{BASEPAGENAME}} {{#switch: {{BASEPAGENAME}}
Line 193: Line 193:
}} }}


===See also=== ==Redirects==
* {{tl|Div col start}}
{{Column-generating template families}}


==See also==
{{Column-generating template families}}


<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |

Revision as of 16:16, 2 January 2015

This is a documentation subpage for Template:Div col.
It may contain usage information, categories and other content that is not part of the original template page.
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.
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)

{{Div col}}, together with {{div col end}}, is used to make a list into columns. It automatically breaks each column into an equal space, meaning, for instance, it isn't necessary to work out the halfway point between two columns. The template also offers options to set a smaller (90%) font-size (|small=yes), place vertical lines ("rules") between the columns (|rules=) and to add other custom styling (|style=).

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

Usage

|cols= or first unnamed parameter
(Now deprecated, as colwidth below 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).
|colwidth= or second unnamed parameter
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.
|rules=
Adds vertical lines ("rules") between the columns if set to yes or some CSS styling (e.g. 1px dashed blue;).
|small=
Specifies small font size (90%) if set to yes.
|style=
CSS styling to apply to the columns.

Examples

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

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Div col in articles based on its 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 closed with {{div col end}}.

Template parameters

ParameterDescriptionTypeStatus
colscols 1

Specifies the number of columns.

Default
2
Stringoptional
colwidthcolwidth 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.

Stringoptional
rulesrules

Produces vertical rules between the columns if set to yes.

Stringoptional
smallsmall

Specifies small font size (90%) if set to yes.

Stringoptional
stylestyle

Specify any custom styling.

Stringoptional

Redirects

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 <div>...</div> open, potentially harming any subsequent formatting.

Column templates
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.