Template:Yes
Yes |
本系列中的模板用于在表格中创建一个含有文本以及适当的背景颜色的单元格。
它们通常用于比较表中。
例如,{{yes}}
将产生一个绿色背景的单元格。单元格中的文本取自第一个参数。例如,{{yes|Sure}}
将输出“Sure”;在未指定第一参数值的情况下,{{yes}}
将输出默认值:“是”。大多数模板允许编者以这种方式覆盖默认文本,有些模板需要在调用后放置文本({{table cell template}} 文本
),有些模板还需要在两者之间使用竖线({{table cell template}} | 文本
)。下表中提供了关于颜色和默认文本的信息。
如果您想对表格单元格使用其他属性,例如colspan
或rowspan
,则需要将它们放在被调用的模板之前,并且与被调用的模板之间不能有竖线|
,例如:
Yes | No | Unavailable |
---|---|---|
Yes/No |
... !{{Yes}} ||{{No}} ||rowspan=2 {{n/a}} |- |colspan=2 {{Yes-No}} ...
模板
Code
Common code to most if not all the templates in this series:
Code specific to this template:
class="table-yes skin-invert" style="text-align:center; background:#90FF90"|Yes
To make a new table cell template you can use: <syntaxhighlight lang=text inline>{{subst:Table cell templates|text= default text |bg= background color |class= a class name without prefix |align= standard horizontal alignment}}</syntaxhighlight>
You should leave out the align
parameter and often the class
parameter is unnecessary, too.
Add the new template to the table in the common documentation afterwards. Please consider reusing one of the other templates and please choose the color sensibly.
If you find a table cell template that does not take a parameter and you want to be able to change the text in the cell, do not duplicate the template! Instead, edit the template and change the text to a default parameter substitution. For example, if a template's text is Dropped
, change that to {{{1|Dropped}}}
.
style="background: #abcdef; color: black; vertical-align: middle; text-align: center; " class="automatic table-automatic"| text
TemplateData
One of several templates for styling individual table cells with standard contents and colors.
Parameter | Description | Type | Status | |
---|---|---|---|---|
text | 1 | text to be displayed instead of the default, if this doesn't work put the text after the template, possibly with a vertical bar | in between
| Line | optional |
horizontal align | align | text alignment inside the cell, either 'left', 'right', 'center' or 'justified'
| Line | optional |
style | style | a semicolon separated list of additional CSS rules to be applied to the table cell
| Line | optional |
background color | color | a valid CSS color value or name to override the standard the cell background, only available with some templates
| Line | optional |
See also
- {{Change}} – calculates, displays and color-codes changes between two values
- {{BSD-lic}} – specialized redirect for Template:Tlf
- {{GPL-lic}} – specialized redirect for Template:Tlf
- {{LGPL-lic}} – specialized redirect for Template:Tlf