模板:Yes/doc
本系列中的模板用於在表格中創建一個含有文本以及適當的背景顏色的單元格。
它們通常用於比較表中。
例如,{{yes}}
將產生一個綠色背景的單元格。單元格中的文本取自第一個參數。例如,{{yes|Sure}}
將輸出「Sure」;在未指定第一參數值的情況下,{{yes}}
將輸出默認值:「是」。大多數模板允許編者以這種方式覆蓋默認文本,有些模板需要在調用後放置文本({{table cell template}} 文本
),有些模板還需要在兩者之間使用豎線({{table cell template}} | 文本
)。下表中提供了關於顏色和默認文本的信息。
如果您想對表格單元格使用其他屬性,例如colspan
或rowspan
,則需要將它們放在被調用的模板之前,並且與被調用的模板之間不能有豎線|
,例如:
是 | 否 | 不適用 |
---|---|---|
是/否 |
... !{{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"|是
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.
參數 | 描述 | 類型 | 狀態 | |
---|---|---|---|---|
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 Template:Tlf
- {{GPL-lic}} – specialized redirect for Template:Tlf
- {{LGPL-lic}} – specialized redirect for Template:Tlf
Notes