模板:No
否 |
本系列中的模板用于在表格中创建一个含有文本以及适当的背景颜色的单元格。
它们通常用于比较表中。
例如,{{yes}}
将产生一个绿色背景的单元格。单元格中的文本取自第一个参数。例如,{{yes|Sure}}
将输出“Sure”;在未指定第一参数值的情况下,{{yes}}
将输出默认值:“是”。大多数模板允许编者以这种方式覆盖默认文本,有些模板需要在调用后放置文本({{table cell template}} 文本
),有些模板还需要在两者之间使用竖线({{table cell template}} | 文本
)。下表中提供了关于颜色和默认文本的信息。
如果您想对表格单元格使用其他属性,例如colspan
或rowspan
,则需要将它们放在被调用的模板之前,并且与被调用的模板之间不能有竖线|
,例如:
是 | 否 | rowspan=2 模板:N/a |
---|---|---|
colspan=2 模板: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-no" style="text-align:center; background:#FF9090"|否
To make a new table cell template you can use:
{{subst:Table cell templates|text= default text |bg= background color |class= a class name without prefix |align= standard horizontal alignment}}
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.
参数 | 描述 | 类型 | 状态 | |
---|---|---|---|---|
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
| 单行文本 | 可选 |
horizontal align | align | text alignment inside the cell, either 'left', 'right', 'center' or 'justified'
| 单行文本 | 可选 |
style | style | a semicolon separated list of additional CSS rules to be applied to the table cell
| 单行文本 | 可选 |
background color | color | a valid CSS color value or name to override the standard the cell background, only available with some templates
| 单行文本 | 可选 |
See also
- {{Change}} – calculates, displays and color-codes changes between two values
- {{BSD-lic}} – specialized redirect for {{free}}
- {{GPL-lic}} – specialized redirect for {{free}}
- {{LGPL-lic}} – specialized redirect for {{free}}
Notes
上述文档嵌入自模板:Table cell templates/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 本模板的子页面。 |