[go: nahoru, domu]

Jump to content

Template:Col-begin/doc: Difference between revisions

From Wikibooks, open books for an open world
[unreviewed revision][checked revision]
Content deleted Content added
m interwiki
Reinstate previous repair
Tag: Undo
 
(41 intermediate revisions by 28 users not shown)
Line 2: Line 2:
<noinclude>{{template doc page viewed directly}}</noinclude>
<noinclude>{{template doc page viewed directly}}</noinclude>
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
{{center|(This is the documentation for: {{PAGENAME}}.)}}
This [[Wikipedia:Template|template]] is a [[Wikipedia:Avoid self-references|self-reference]] and so is part of the Wikipedia project rather than the encyclopedic content.

{{#switch:{{lc:{{PAGENAME}}}}
| col-2 = The [[Template:Col-2]] sets column width for each of 2 columns, with align=left, valign=top. The width, align or valign can be changed: <nowiki>{{col-2 |width=40%|align=right|valign=center}}</nowiki>.<br><br>
| col-3 = The [[Template:Col-3]] sets column width for each of 3 columns, with align=left, valign=top. The width, align or valign can be changed: <nowiki>{{col-3 |width=25%|align=right|valign=center}}</nowiki>.<br><br>
| col-4 = The [[Template:Col-4]] sets column width for each of 4 columns.<br><br>
| col-5 = The [[Template:Col-5]] sets column width for each of 5 columns.<br><br>
| col-6 = The [[Template:Col-6]] sets column width for each of 6 columns, with align=left, valign=top. The width, align or valign can be changed: <nowiki>{{col-6 |width=20%|align=right|valign=center}}</nowiki>.<br><br>
| col-start=The [[Template:Col-start]] begins a wikitable (same as <nowiki>{{col-begin}}</nowiki>).<br><br>
}}
The {{tl|col-begin}}, {{tl|col-break}} and {{tl|col-end}} templates control columns of text on a page:
:*<nowiki>{{col-begin}}</nowiki> - starts a table (followed by <nowiki>{{col-break}}</nowiki> for 1st column)
:*<nowiki>{{col-break}}</nowiki> - triggers the start of each column
:*<nowiki>{{col-end}}</nowiki> - ends the multi-column table.
The widths of columns can be specified by using various additional codes. See below for examples.


==Usage==
==Usage==
:: <nowiki>{{col-begin|width=70%}}</nowiki> - start table with width.
A border of 2px (1px width on each side) corresponds to a 5%. Therefore, with a 2px border — for example, as in [[Wikipedia:Tutorial (Wrap-up and more info)]] — the width needs to be 95% for the table to fit within the screen. Since it's possible that some tables might not have a border, correction on the individual page could be made after substitution. Another way to create a two column table is like this:
:: <nowiki>{{col-break|width=66%}}</nowiki> - start column-1 as 66% wide.
:: This is text in col-1.
:: <nowiki>{{col-break|width=33%}}</nowiki> - start column-2 as 33% wide.
:: Text column-2.
:: <nowiki>{{col-end}}</nowiki>
The table will have 2 columns, with column 1 twice (2x) the width of column 2.

A border of 2px (1px width on each side) corresponds to a 5%. Therefore, with a 2px border the width needs to be 95% for the table to fit within the screen. Since it's possible that some tables might not have a border, correction on the individual page could be made after substitution. Another way to create a two column table is like this:


{|
{|
Line 22: Line 44:
{{col-begin}}
{{col-begin}}


{{col-1-of-4}}
{{col-4}}


{{tl|Col-begin}}
{{tl|Col-begin}}
Line 31: Line 53:
{{tl|Col-end}}
{{tl|Col-end}}


{{col-2-of-4}}
{{col-4}}


{{tl|Col-begin}}
{{tl|Col-begin}}
Line 42: Line 64:
{{tl|Col-end}}
{{tl|Col-end}}


{{col-3-of-4}}
{{col-4}}


{{tl|Col-begin}}
{{tl|Col-begin}}
Line 55: Line 77:
{{tl|Col-end}}
{{tl|Col-end}}


{{col-4-of-4}}
{{col-4}}


and so on, up to {{tl|Col-7}}
and so on, up to {{tl|Col-5}}


{{col-end}}
{{col-end}}


{{col-begin}}
{{col-begin}}
{{col-2}}

{{col-1-of-4}}

&#123;{[[Template:Col-begin|Col-begin]]|class=references-small}}
&#123;{[[Template:Col-begin|Col-begin]]|class=references-small}}
{{tl|Col-break}}
{{tl|Col-break}}
Line 80: Line 100:
{{tl|Col-end}}
{{tl|Col-end}}


{{col-2-of-4}}
{{col-2}}

{{tl|Top}}
Column 1 here
{{tl|Mid}}
Column 2 here
{{tl|Bottom}}

{{col-3-of-4}}

&#123;{[[Template:Columns-start|Columns-start]]|num=3}}
Column 1 here
{{tl|Column}}
Column 2 here
{{tl|Column}}
Column 3 here
{{tl|Columns-end}}

{{col-4-of-4}}

{{tl|Multicol}}
{{tl|Multicol}}
Column 1 here
Column 1 here
Line 111: Line 112:


{{col-end}}
{{col-end}}
==Examples==
See [[Template:Col-break/examples|Col-break/examples]]


==See also==
==See also==
{{Column templates see also}}
* {{tl|Col-begin}} ({{tl|Col-start}}), {{tl|Col-begin-small}} {{lts/|Col-begin}}
** {{tl|Col-2}} <small>({{tl|Col-1-of-2}}, {{tl|Col-2-of-2}})</small>
** {{tl|Col-3}} <small>({{tl|Col-1-of-3}}, {{tl|Col-2-of-3}}, {{tl|Col-3-of-3}})</small>
** {{tl|Col-4}} <small>({{tl|Col-1-of-4}}, {{tl|Col-2-of-4}}, {{tl|Col-3-of-4}}, {{tl|Col-4-of-4}})</small>
** {{tl|Col-5}} <small>({{tl|Col-1-of-5}}, {{tl|Col-2-of-5}}, {{tl|Col-3-of-5}}, {{tl|Col-4-of-5}}, {{tl|Col-5-of-5}})</small>
** {{tl|Col-6}} <small>({{tl|Col-1-of-6}}, {{tl|Col-2-of-6}}, {{tl|Col-3-of-6}}, {{tl|Col-4-of-6}}, {{tl|Col-5-of-6}}, {{tl|Col-6-of-6}})</small>
** {{tl|Col-7}}
** {{tl|Col-break}}
* {{tl|Col-end}} ({{tl|End}})
* {{tl|Top}}, {{tl|Mid}}, {{tl|Bottom}}
* {{tl|Columns-start}}, {{tl|Column}}, {{tl|Columns-end}} {{lts/|Columns-start}}
* {{tl|Multicol}}, {{tl|Multicol-break}}, {{tl|Multicol-end}} {{lts/|Multicol}}
* {{tl|Div col}}, {{tl|Div col end}} {{lts/|Div col}}
* [[Wikipedia talk:Manual of Style/Archive 35#Columns in articles]]

==External links==
* [http://www.htmlcodetutorial.com/_MULTICOL.html MULTICOL HTML tag]
* [http://developer.mozilla.org/en/docs/CSS3_Columns CSS3 Columns], -moz-column-count

<includeonly>
<includeonly>
<!-- ADD CATEGORIES BELOW THIS LINE -->
<!-- ADD CATEGORIES BELOW THIS LINE -->
[[Category:Table and column templates|{{SUBJECTPAGENAME}}]]
[[Category:Column templates|{{PAGENAME}}]]


<!-- ADD INTERWIKIS BELOW THIS LINE -->
<!-- ADD INTERWIKIS BELOW THIS LINE -->
[[eo:Ŝablono:Kol-komenco]]
[[ko:틀:Col-begin]]
[[no:Mal:Col-begin]]
[[zh:Template:Col-begin]]
</includeonly>
</includeonly>

Latest revision as of 12:49, 5 June 2024

(This is the documentation for: Col-begin/doc.)


The {{col-begin}}, {{col-break}} and {{col-end}} templates control columns of text on a page:

  • {{col-begin}} - starts a table (followed by {{col-break}} for 1st column)
  • {{col-break}} - triggers the start of each column
  • {{col-end}} - ends the multi-column table.

The widths of columns can be specified by using various additional codes. See below for examples.

{{col-begin|width=70%}} - start table with width.
{{col-break|width=66%}} - start column-1 as 66% wide.
This is text in col-1.
{{col-break|width=33%}} - start column-2 as 33% wide.
Text column-2.
{{col-end}}

The table will have 2 columns, with column 1 twice (2x) the width of column 2.

A border of 2px (1px width on each side) corresponds to a 5%. Therefore, with a 2px border the width needs to be 95% for the table to fit within the screen. Since it's possible that some tables might not have a border, correction on the individual page could be made after substitution. Another way to create a two column table is like this:

{{col-begin|width=95%}}
|-
| 
Left column
|
Right column
|}


{{Col-begin}}
{{Col-2}}
Column 1 here
{{Col-2}}
Column 2 here
{{Col-end}}


{{Col-begin}}
{{Col-3}}
Column 1 here
{{Col-3}}
Column 2 here
{{Col-3}}
Column 3 here
{{Col-end}}


{{Col-begin}}
{{Col-4}}
Column 1 here
{{Col-4}}
Column 2 here
{{Col-4}}
Column 3 here
{{Col-4}}
Column 4 here
{{Col-end}}


and so on, up to {{Col-5}}


{{Col-begin|class=references-small}}
{{Col-break}}
Column 1 here
{{Col-break}}
Column 2 here
{{Col-break}}
Column 3 here
{{Col-break}}
Column 4 here
{{Col-break}}
Column 5 here
{{Col-break}}
Column 6 here
{{Col-end}}

{{Multicol}}
Column 1 here
{{Multicol-break}}
Column 2 here
{{Multicol-break}}
Column 3 here
{{Multicol-break}}
Column 4 here
{{Multicol-end}}


See also

[edit source]