Template:Cell: Difference between revisions

From Wikishire
Jump to navigation Jump to search
Created page with '{{#if:{{{1|}}}|<td style="background: {{{1}}}; {{{style|font-size:50%;}}}">{{{2| }}}</td>| <code><nowiki>{{cell|</nowiki>''COLOUR''<nowiki>}}</nowiki></code>}} <noinclude> {…'
 
RB (talk | contribs)
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#if:{{{1|}}}|<td style="background: {{{1}}}; {{{style|font-size:50%;}}}">{{{2|&nbsp;}}}</td>|
{| class="wikitable" style="width: 100%;"
<code><nowiki>{{cell|</nowiki>''COLOUR''<nowiki>}}</nowiki></code>}}
|-
<noinclude>
|style="background-color:{{#if:{{{1|}}}|{{#replace:{{{1}}}|#|&#35;}}|&#35;ffffff}}"|{{#if:{{{2|}}}|{{{2}}}|&nbsp;}}
|}<noinclude>
{{documentation}}
{{documentation}}
</noinclude>
</noinclude>

Latest revision as of 22:08, 9 March 2024

 
[edit] [{{#invoke:Purge|main}}] Template documentation

The {{cell}} template can be used to create a table cell with a specified background colour.

Usage

 

The template takes one unnamed parameter as input, which is the background colour of the table cell. The default content of each cell is a single non-breaking space with a font-size of 50%. To override the content of each cell, use a second unnamed parameter. To override the default font-size, use the style= parameter.

Complete specification
{{cell|Colour|Text|style=Style}}
Default
{{cell|Colour|&nbsp;|style=font-size:50%;}}

Examples

Example 1

Code
{| width="50%" cellspacing=0
{{cell|red}}{{cell|blue}}{{cell|green}}
|}
Result
 
 
 

Example 2

Code
{| width="50%" cellspacing=0
{{cell|red| }}{{cell|blue| }}{{cell|green| }}
|}
Result
 
 
 

Example 3

Code
{| width="50%" cellspacing=0
{{cell|red|R|style=text-align:center}}{{cell|blue|B|style=text-align:center}}{{cell|green|G|style=text-align:center}}
|}
Result
R
B
G

Note

The {{cell2}} and {{cell3}} templates can be used to condense a sequence of cells of the same colour.

See also