模板:Okay
| 中立 |
頁面Module:Documentation/styles.css沒有內容。
本系列中的模板用於在表格中創建一個含有文本以及適當的背景顏色的單元格。
它們通常用於比較表中。
例如,Template:Tlx將產生一個綠色背景的單元格。單元格中的文本取自第一個參數。例如,Template:Tlx將輸出「Sure」;在未指定第一參數值的情況下,Template:Tlx將輸出默認值:「是」。大多數模板允許編者以這種方式覆蓋默認文本,有些模板需要在調用後放置文本({{table cell template}} 文本),有些模板還需要在兩者之間使用豎線({{table cell template}} | 文本)。下表中提供了關於顏色和默認文本的信息。
File:Nuvola apps important.svg 重要提醒:如果您想對表格單元格使用其他屬性,例如colspan或rowspan,則需要將它們放在被調用的模板之前,並且與被調用的模板之間不能有豎線|,例如:
| 是 | 否 | 不適用 |
|---|---|---|
| 是/否 | ||
...
!{{Yes}} ||{{No}} ||rowspan=2 {{n/a}}
|-
|colspan=2 style="border:solid 3px Maroon" {{Yes-No}}
...
模板[編輯]
原始碼[編輯]
Common code to most if not all the templates in this series:
style="background: #abcdef; color: black; vertical-align: middle; text-align: {{{align|center}}}; {{{style|}}}" class="automatic table-automatic skin-invert"| {{{1|text}}}
Code specific to this template:
style="background: #FFD; color: black; vertical-align: middle; text-align: center; " class="partial table-partial skin-invert"| 中立
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>{ "description": "One of several templates for styling individual table cells with standard contents and colors.", "params": { "1": {
"label": "text", "description": "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", "type": "string/line", "default": "(template dependent)", "required": false
}, "align": {
"label": "horizontal align", "description": "text alignment inside the cell, either 'left', 'right', 'center' or 'justified'", "default": "center", "inherits": "1"
}, "style": {
"label": "style", "description": "a semicolon separated list of additional CSS rules to be applied to the table cell", "default": "", "inherits": "1"
}, "color": {
"label": "background color", "description": "a valid CSS color value or name to override the standard the cell background, only available with some templates", "inherits": "1"
} }}</templatedata>
參見[編輯]
- {{Change}} – calculates, displays and color-codes changes between two values
- {{BSD-lic}} – specialized redirect for 腳本錯誤:沒有「Tlg」這個模塊。
- {{GPL-lic}} – specialized redirect for 腳本錯誤:沒有「Tlg」這個模塊。
- {{LGPL-lic}} – specialized redirect for 腳本錯誤:沒有「Tlg」這個模塊。
註釋[編輯]
- ↑ 可以在用戶樣式表中引用表格單元格模板的HTML屬性以更改外觀。
- ↑ 2.0 2.1 Does not take a parameter; the content should be placed after the template call, separated by a pipe (|) character.
- ↑ 該模板在英文維基百科與Template:WikiProject link相關(中文維基百科無此專題)。
- ↑ 該模板與Template:WikiProject link相關
- ↑ 該模板與Template:WikiProject link相關。
- ↑ 該模板與Template:WikiProject link相關。