Difference between revisions of "Template:Columns"

From blackwiki
Jump to navigation Jump to search
imported>Mr. Guye
m (v1.43 - Fixing errors on many pages / WP:WCW project (Category duplication))
imported>Amorymeltzer
m (Changed protection level for "Template:Columns": Highly visible template: Transclusion count has increased — Move from semi to template-protected for editing, and down from sysop for move-protection. ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)))
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<table class="multicol" style="{{#switch:{{{align|}}}
+
<templatestyles src="Columns/styles.css" /><table class="multicol" style="{{#switch:{{{align|}}}
 
   |left|right=float:{{{align}}}
 
   |left|right=float:{{{align}}}
 
   |center=margin:0.5em auto
 
   |center=margin:0.5em auto
Line 8: Line 8:
 
{{#if:{{{col2<includeonly>|</includeonly>}}}
 
{{#if:{{{col2<includeonly>|</includeonly>}}}
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
<td style="width:{{{col2width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col2style|}}};">{{#ifeq:{{{col2width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|}}
+
<td style="width:{{{col2width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col2style|}}};">{{#ifeq:{{{col2width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|[[Category:Pages using columns with the default column width]]}}
 
{{{col2}}}</td>
 
{{{col2}}}</td>
 
}}{{#if:{{{col3<includeonly>|</includeonly>}}}
 
}}{{#if:{{{col3<includeonly>|</includeonly>}}}
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
<td style="width:{{{col3width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col3style|}}};">{{#ifeq:{{{col3width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|}}
+
<td style="width:{{{col3width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col3style|}}};">{{#ifeq:{{{col3width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|[[Category:Pages using columns with the default column width]]}}
 
{{{col3}}}</td>
 
{{{col3}}}</td>
 
}}{{#if:{{{col4<includeonly>|</includeonly>}}}
 
}}{{#if:{{{col4<includeonly>|</includeonly>}}}
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
<td style="width:{{{col4width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col4style|}}};">{{#ifeq:{{{col4width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|}}
+
<td style="width:{{{col4width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col4style|}}};">{{#ifeq:{{{col4width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|[[Category:Pages using columns with the default column width]]}}
 
{{{col4}}}</td>
 
{{{col4}}}</td>
 
}}{{#if:{{{col5<includeonly>|</includeonly>}}}
 
}}{{#if:{{{col5<includeonly>|</includeonly>}}}
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
<td style="width:{{{col5width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col5style|}}};">{{#ifeq:{{{col5width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|}}
+
<td style="width:{{{col5width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col5style|}}};">{{#ifeq:{{{col5width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|[[Category:Pages using columns with the default column width]]}}
 
{{{col5}}}</td>
 
{{{col5}}}</td>
 
}}{{#if:{{{col6<includeonly>|</includeonly>}}}
 
}}{{#if:{{{col6<includeonly>|</includeonly>}}}
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
<td style="width:{{{col6width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col6style|}}};">{{#ifeq:{{{col6width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|}}
+
<td style="width:{{{col6width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col6style|}}};">{{#ifeq:{{{col6width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|[[Category:Pages using columns with the default column width]]}}
 
{{{col6}}}</td>
 
{{{col6}}}</td>
 
}}{{#if:{{{col7<includeonly>|</includeonly>}}}
 
}}{{#if:{{{col7<includeonly>|</includeonly>}}}
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
<td style="width:{{{col7width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col7style|}}};">{{#ifeq:{{{col7width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|}}
+
<td style="width:{{{col7width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col7style|}}};">{{#ifeq:{{{col7width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|[[Category:Pages using columns with the default column width]]}}
 
{{{col7}}}</td>
 
{{{col7}}}</td>
 
}}{{#if:{{{col8<includeonly>|</includeonly>}}}
 
}}{{#if:{{{col8<includeonly>|</includeonly>}}}
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
<td style="width:{{{col8width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col8style|}}};">{{#ifeq:{{{col8width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|}}
+
<td style="width:{{{col8width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col8style|}}};">{{#ifeq:{{{col8width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|[[Category:Pages using columns with the default column width]]}}
 
{{{col8}}}</td>
 
{{{col8}}}</td>
 
}}{{#if:{{{col9<includeonly>|</includeonly>}}}
 
}}{{#if:{{{col9<includeonly>|</includeonly>}}}
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
<td style="width:{{{col9width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col9style|}}};">{{#ifeq:{{{col9width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|}}
+
<td style="width:{{{col9width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col9style|}}};">{{#ifeq:{{{col9width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|[[Category:Pages using columns with the default column width]]}}
 
{{{col9}}}</td>
 
{{{col9}}}</td>
 
}}{{#if:{{{col10<includeonly>|</includeonly>}}}
 
}}{{#if:{{{col10<includeonly>|</includeonly>}}}
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
 
       | <td style="width:{{{gapbetween|{{{gap|1.25em}}}}}};"></td>
<td style="width:{{{col10width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col10style|}}};">{{#ifeq:{{{col10width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|}}
+
<td style="width:{{{col10width|{{{colwidth|{{{width|15.0em}}}}}}}}};{{{colstyle|}}};{{{col10style|}}};">{{#ifeq:{{{col10width|{{{colwidth|{{{width|15.0em}}}}}}}}}|15.0em|[[Category:Pages using columns with the default column width]]}}
 
{{{col10}}}</td>
 
{{{col10}}}</td>
 
}}
 
}}
 
</tr></table><noinclude>{{Documentation}}</noinclude>
 
</tr></table><noinclude>{{Documentation}}</noinclude>

Latest revision as of 14:35, 3 August 2018

Template documentation[view] [edit] [history] [purge]

Script error: No such module "Uses TemplateStyles". {{Columns}} may be used to create up to ten columns across a page.

Syntax

Values for col1 and col2, i.e. the contents of the first and second columns, are expected.

{{Columns
| background =   <!-- Background (default is none) -->
| style =        <!-- Use to add extra overall CSS styling -->
| colwidth =     <!-- Width of each column (default 15.0em) -->
| gapbetween =   <!-- Gap (gutter) between each column (default 1.25em) -->
| col1width =    <!-- Use to set a custom width for col1 -->
| col1 =         <!-- (REQUIRED) First column's contents -->
| col2width =    <!-- Use to set a custom width for col2 (and so on) -->
| col2 =         <!-- (REQUIRED) Second column's contents -->
| col3width = 
| col3 = 
...
| col10width = 
| col10 = 
}}

The parameters  colstyle  and  col1style  to  col10style  may also be used to tailor all and/or individual columns' CSS styling.

Examples

Code
{{Columns
| col1 = This is a simple application of the columns template, demonstrating the default column widths
| col2 = and gaps between columns. See the next example for a more customized use of the template.
}}
Result



Code
{{Columns |background=beige |colwidth=8.5em |gap<!--between-->=3.25em

| col1 =
* These
* columns
* are
* more
* complex

| col2 =
The<br />background<br />is<br />beige

| col3 =
; Each : column
; is   : 8.5 [[Em (typography)|''em'']]
; wide

| col4 =
{{{!}}
!colspan="2"{{!}} and
{{!-}}
{{!}} the {{!!}} gap
{{!-}}
{{!}}colspan="2"{{!}} between
{{!-}}
{{!}} each {{!!}} is
{{!-}}
!colspan="2" align="center"{{!}} 3.25 ''em''
{{!}}}
}}
Result

See also

Column-generating template families

<section begin="table" />

Family Type
Handles wiki
 table code?Script error: No such module "If empty".
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}}

Script error: No such module "If empty". 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" />