แม่แบบในชุดนี้ออกแบบมาเพื่อใช้ในตารางเพื่อสร้างเซลล์ข้อมูลที่มีข้อความพร้อมทั้งพื้นหลังเป็นสีที่สื่อความหมายอย่างเหมาะสม มักใช้บ่อยในการจัดทำตารางเปรียบเทียบ
ตัวอย่างเช่น {{yes}}
จะสร้างเซลล์ที่ให้สีพื้นหลังสีเขียว ข้อความในเซลล์นั้นจะนำมาจากพารามิเตอร์หลัง เช่น {{yes|Sure}}
จะแสดงคำว่า "Sure" แทนที่คำว่า "Yes" แม่แบบส่วนใหญ่จะอนุญาตให้ผู้ใช้แทนที่ข้อความเริ่มต้นด้วยวิธีนี้ บางคนอาจต้องการข้อความที่ปรากฏตามที่แม่แบบได้กำหนดไว้แต่แรก บางคนอาจต้องการแถบแนวตั้งในระหว่าง {{table cell template}} text
หรือ {{table cell template}} | text
ข้อมูลนี้นั้นทั้งสีและข้อความเริ่มต้นจะอยู่ในตารางด้านล่างดังต่อไปนี้
หากคุณต้องการใช้แอตทริบิวต์อื่น ๆ สำหรับเซลล์ตารางเช่น colspan
หรือ rowspan
ต้องวางก่อนการเรียกใช้แม่แบบ และต้องไม่มีแถบแนวตั้ง |
ขั้นอยู่ระหว่างข้อความนั้น ๆ
...
!{{Yes}} ||{{No}} ||rowspan=2 {{n/a}}
|-
|colspan=2 {{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"| {{{1|text}}}
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
ข้อมูลแม่แบบ
พารามิเตอร์แม่แบบ
พารามิเตอร์ | คำอธิบาย | ชนิด | สถานะ |
---|
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 - ค่าปริยาย
- (template dependent)
| เนื้อหา | แนะนำ |
---|
horizontal align | align | text alignment inside the cell, either 'left', 'right', 'center' or 'justified' - ค่าปริยาย
- center
| สตริง | แนะนำ |
---|
style | style | a semicolon separated list of additional CSS rules to be applied to the table cell - ค่าปริยาย
- (template dependent)
| สตริง | แนะนำ |
---|
background color | color | a valid CSS color value or name to override the standard the cell background, only available with some templates - ค่าปริยาย
- (template dependent)
| บรรทัด | แนะนำ |
---|
No. place | place | Order of various prizes
| ไม่ทราบชนิด | เลือกได้ |
---|
- ↑ The HTML class of table cell templates may be referenced in a user stylesheet to change appearance.
- ↑ 2.0 2.1 Does not take a parameter; the content should be placed after the template call, separated by a pipe (|) character.