Difference between revisions of "Template:Multicol"

From Shadow of the Throne Wiki
Jump to: navigation, search
({{template doc}})
Line 3: Line 3:
 
|- valign="top"
 
|- valign="top"
 
|<div style="margin-right:{{{2|20px}}};"></includeonly><noinclude>
 
|<div style="margin-right:{{{2|20px}}};"></includeonly><noinclude>
== Usage ==
+
{{template doc}}
{{tl|Multicol}} is used to start a multi-column section of a page. Between each block of column text insert <tt>{{tl|Multicol-break}}</tt> and close the last column with <tt>{{tl|Multicol-end}}</tt>. For example:
+
 
+
<pre>
+
{{Multicol}}
+
This text appears in the first column.
+
{{Multicol-break}}
+
This text appears in the second column.
+
{{Multicol-break}}
+
This text appears in the third column.
+
{{Multicol-end}}
+
</pre>
+
 
+
You can have any number of columns. Each column will be the same width, equally dividing the available horizontal space. Each column has a small right margin (20 pixels), creating a "gutter" that prevents text in one column from touching text in the column to its right. See [[User:Franl|franl]]'s user page for examples of how this template can be used.
+
 
+
== Parameters ==
+
This template has two optional parameters: the overall width of the set of columns and the width of the gutter.  The overall width of the set of columns can be an absolute value (e.g., <tt>40em</tt>) or a percentage of the available page width (e.g., <tt>50%</tt>). This parameter defaults to <tt>100%</tt>. For example, to create a multi-column section that is only 50% the width of the page:
+
 
+
<pre>
+
{{Multicol|50%}}
+
This text appears in the first column.
+
{{Multicol-break}}
+
This text appears in the second column.
+
{{Multicol-break}}
+
This text appears in the third column.
+
{{Multicol-end}}
+
</pre>
+
 
+
The multi-column region is always positioned on the left side of the containing block. To change this, place the above Wikitext in a <tt>[[DIV (HTML tag)|DIV]]</tt> block that has the [[Cascading Style Sheet|CSS]] attribute <tt>text-align</tt> set to either <tt>center</tt> or <tt>right</tt>, like this:
+
 
+
<pre>
+
<div style="text-align:center;">{{center|
+
{{Multicol|50%}}
+
...
+
{{Multicol-end}}
+
}}</div>
+
</pre>
+
 
+
== Related templates ==
+
The templates {{tl|Col-begin}} and friends do something similar to this template and its friends, but this template may be easier to use. Each of the following examples produce the same result (a 3-column table in which all columns have equal width):
+
 
+
<center>
+
{{Multicol|50%}}
+
<pre>
+
{{Multicol}}
+
Column 1
+
{{Multicol-break}}
+
Column 2
+
{{Multicol-break}}
+
Column 3
+
{{Multicol-end}}
+
</pre>
+
{{Multicol-break}}
+
<pre>
+
{{Col-begin}}
+
{{Col-3}}
+
Column 1
+
{{Col-3}}
+
Column 2
+
{{Col-3}}
+
Column 3
+
{{Col-end}}
+
</pre>
+
{{Multicol-end}}
+
</center>
+
 
+
It's simpler to add more columns to the {{tl|Multicol}} example than to the {{tl|Col-begin}} example, because in the latter case, all occurrences of {{tl|Col-3}} would need to be changed to {{tl|Col-4}}.
+
 
+
[[Category:Table and column templates]]
+
 
+
[[zh:template:multicol]]
+
 
</noinclude>
 
</noinclude>

Revision as of 22:04, 19 October 2007

{{#ifeq: Multicol | sandbox

|
Template:Template sandbox notice }}Template:Template other
{{#ifeq: ¬ |

|

|
{{
 #if: 
 | 
 | 
   {{
   #if: {{#ifexist: 
   {{#if: 
   |    
   | {{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

}}:{{#switch: Multicol | sandbox | testcases = Multicol | #default = Multicol }}/doc

   }}
 | yes
 }}
   | [[[{{#if: 
 | 
 | {{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

}}:{{#switch: Multicol | sandbox | testcases = Multicol | #default = Multicol }}/doc

 }}|view]]] [[{{fullurl:{{#if: 
 | 
 | {{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

}}:{{#switch: Multicol | sandbox | testcases = Multicol | #default = Multicol }}/doc

 }}|action=edit}} edit]] [[{{fullurl:{{#if: 
 | 
 | {{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

}}:{{#switch: Multicol | sandbox | testcases = Multicol | #default = Multicol }}/doc

 }}|action=history}} history]] [purge] 
   | 
     [[{{fullurl:{{#if: 
 | 
 | {{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

}}:{{#switch: Multicol | sandbox | testcases = Multicol | #default = Multicol }}/doc

 }}| action=edit&preload={{
       #if:  
       | 
       | {{#ifeq: Template | File
         | Template:Documentation/preload-filespace
         | Template:Documentation/preload
         }} }} }} create]]
   }}
 }} {{#switch: ¬
 | ¬ =   
   {{#switch: Template 
   | Template = 50px Template documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   ¬
}}

}} {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:{{#switch: Template

 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

}}:{{#switch: Multicol | sandbox | testcases = Multicol | #default = Multicol }}/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ {{#switch: Template

 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

}}:{{#switch: Multicol | sandbox | testcases = Multicol | #default = Multicol }}/doc }} | 0000 | 0100 | 0010 | 0101 = }}

{{#if:
 {{#ifeq:  | off
 |
 | {{#ifexist: 
   {{#if: 
   |    
   | {{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

}}:{{#switch: Multicol | sandbox | testcases = Multicol | #default = Multicol }}/doc

   }}
 | yes
 }}{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}
| {{#ifeq:none|none | | }} {{#if: |

}}

{{#switch:

| | warning | editnotice | system =

| #default =
This message box is using an invalid "type=" parameter and needs fixing.
[[Category:Wikipedia message box parameter needs fixing|Template:Main otherTemplate:Multicol]]

}} }}{{#if:

 {{#switch: Multicol
 | doc
 | testcases = strange
 }}

| [[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Multicol]]

}}