Template:Cw: Difference between revisions

From Wikishire
Jump to navigation Jump to search
RB (talk | contribs)
Created page with '<includeonly>width="{{#var:colw{{{1}}}}}";<noinclude>Cw</includeonly><noinclude>{{Template:Colwidths/doc}}'
 
RB (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>width="{{#var:colw{{{1}}}}}";<noinclude>[[Category:Table templates|Cw]]</includeonly><noinclude>{{Template:Colwidths/doc}}
<includeonly>width="{{#switch:{{{1}}}
|1={{#var:colw1}}
|2={{#var:colw2}}
|3={{#var:colw3}}
|4={{#var:colw4}}
|5={{#var:colw5}}
|6={{#var:colw6}}
|7={{#var:colw7}}
|8={{#var:colw8}}
|15%
}}"<noinclude>[[Category:Table templates|Cw]]</includeonly><noinclude>{{Template:Colwidths/doc}}

Latest revision as of 22:41, 19 July 2013

Template:Colwidths is to allow you to set the width of columns in each of a set of tables on a page, so that the tables remain in alignment notwithstanding that they are independent tables and the contents differ.

Template:cw actually defines the column widths, but it is fed its values by {{Colwidths}}


These are not sophisticated templates nor complicated to use:

Basic use: percentage widths

1.  At the top of the page add {{Colwidths}} with the widths you want as percentages. It will take up to 8 columns, so:

{{Colwidths|30|50|20}}

is to define three columns as 30%, 50% and 20% respectively.

2.  In each table to which these values are to apply, use {{cw}}: Begin column 1 with:

{{cw|1}}|

Begin column 2 with:

{{cw|2}}|


and so forth.

A table without {{cw}} in it does not form part of the scheme and its columns must be defined individually.

Fixed widths

The templates assume that percentages are to be used, so "30" is read as "30%". If however you wish to use fixed widths (as for example here), then in {{Colwidths}} add an "f" (for "fixed") after the number:

{{Colwidths|110f|50|250f}}

A mixture of fixed widths and percentages is possible: in the above example the "50" has no "f" suffixed and so it is taken as "50%".

The {{Cw}} template is used in exactly the same way in this example.