Template:DefTable: Difference between revisions
PWpedia>Sangodoc Fixed |
PWpedia>Sangodoc Added text alignment |
||
| Line 1: | Line 1: | ||
style="background:{{{bkg|#171513}}}; padding: {{{padwid|2}}}px {{{padhgt|2}}}px; border: {{{bdrwid|1}}}px {{{bdrparam|solid}}} {{{bdrcolor|#B2B2B2}}};" border="{{{cellbdrwid|1}}}" cellpadding="{{{cellpad|4}}}"<noinclude> | style="background:{{{bkg|#171513}}}; padding: {{{padwid|2}}}px {{{padhgt|2}}}px; border: {{{bdrwid|1}}}px {{{bdrparam|solid}}} {{{bdrcolor|#B2B2B2}}}; text-align: {{{txtalgn|left}}};" border="{{{cellbdrwid|1}}}" cellpadding="{{{cellpad|4}}}"<noinclude> | ||
| Line 8: | Line 8: | ||
Normally it is recommended that you do not use any of the parameters so that the wiki has a consistent look. However, the DefTable template supports the following parameters for use in special cases: | Normally it is recommended that you do not use any of the parameters so that the wiki has a consistent look. However, the DefTable template supports the following parameters for use in special cases: | ||
:'''txtalgn''' - The alignment of the text within the (non-!) cells, defaults to '''left'''. Parameter options are "left", "center", "right", "justify", and "inherit". (Note that cells that start with "!" default to being centered and bold.) | |||
:'''bkg''' - The table's background color, defaults to '''#171513'''. (It is recommended that you ''do not'' override this default value.) | :'''bkg''' - The table's background color, defaults to '''#171513'''. (It is recommended that you ''do not'' override this default value.) | ||
:'''padwid''' - The width of the padding on the left and right sides of the table, defaults to '''2'''. | :'''padwid''' - The width of the padding on the left and right sides of the table, defaults to '''2'''. | ||
| Line 29: | Line 31: | ||
! Headers | ! Headers | ||
|- | |- | ||
! Row | ! Wide Row | ||
| | | Wide example text | ||
|- | |- | ||
! | ! Note | ||
| | | Alignment | ||
|} | |} | ||
| Line 44: | Line 46: | ||
! Headers | ! Headers | ||
|- | |- | ||
! | ! Wide row | ||
| | | Wide example text | ||
|- | |- | ||
! | ! Note | ||
| | | Alignment | ||
|} | |} | ||
Or, in special cases, it can be used with parameters, as in this example: | Or, in special cases, it can be used with parameters, as in this example: | ||
{<nowiki>| {{DefTable|bkg=#000000|padwid=0|padhgt=0|cellpad=10}} cellspacing="0"</nowiki> | {<nowiki>| {{DefTable|bkg=#000000|padwid=0|padhgt=0|cellpad=10|txtalgn=center}} cellspacing="0"</nowiki> | ||
|+ <nowiki>'''Example Table'''</nowiki> | |+ <nowiki>'''Example Table'''</nowiki> | ||
|- | |- | ||
| Line 59: | Line 61: | ||
! Headers | ! Headers | ||
|- | |- | ||
! Row | ! Wide Row | ||
| | | Wide example text | ||
|- | |- | ||
! | ! Note | ||
| | | Alignment | ||
|} | |} | ||
Which produces the following table: | Which produces the following table: | ||
{| {{DefTable|bkg=#000000|padwid=0|padhgt=0|cellpad=10}} cellspacing="0" | {| {{DefTable|bkg=#000000|padwid=0|padhgt=0|cellpad=10|txtalgn=center}} cellspacing="0" | ||
|+ '''Example Table''' | |+ '''Example Table''' | ||
|- | |- | ||
| Line 74: | Line 76: | ||
! Headers | ! Headers | ||
|- | |- | ||
! | ! Wide row | ||
| | | Wide example text | ||
|- | |- | ||
! | ! Note | ||
| | | Alignment | ||
|} | |} | ||
</noinclude> | </noinclude> | ||
Revision as of 17:18, 3 November 2012
style="background:#171513; padding: 2px 2px; border: 1px solid #B2B2B2; text-align: left;" border="1" cellpadding="4"
This is a default table header (deftable) for use in standard tables to provide a uniform look and to make it easier to update all/most tables simultaneously should the wiki's style (CSS) be updated again.
Parameters
Normally it is recommended that you do not use any of the parameters so that the wiki has a consistent look. However, the DefTable template supports the following parameters for use in special cases:
- txtalgn - The alignment of the text within the (non-!) cells, defaults to left. Parameter options are "left", "center", "right", "justify", and "inherit". (Note that cells that start with "!" default to being centered and bold.)
- bkg - The table's background color, defaults to #171513. (It is recommended that you do not override this default value.)
- padwid - The width of the padding on the left and right sides of the table, defaults to 2.
- padhgt - The height of the padding on the top and bottom of the table, defaults to 2.
- bdrwid - The width of the line around the outside of the table, defaults to 1.
- bdrcolor - The color of the line around the table, defaults to #B2B2B2. (It is recommended that you do not override this default value.)
- bdrparam - Used for other border parameters, defaults to solid.
- cellbdrwid - The width of the line around each cell inside the table, defaults to 1.
- cellpad - The amount of padding between the text and the sides of the table, defaults to 4.
NOTE: It is recommended that you do not change the color parameters. This is because if the colors in this template get updated to match a new wiki style/color scheme, your table will not be updated to match it.
Examples
This template should normally be used as in the following example:
{| {{DefTable}}
|+ '''Example Table'''
|-
! Column
! Headers
|-
! Wide Row
| Wide example text
|-
! Note
| Alignment
|}
Which produces the following table:
| Column | Headers |
|---|---|
| Wide row | Wide example text |
| Note | Alignment |
Or, in special cases, it can be used with parameters, as in this example:
{| {{DefTable|bkg=#000000|padwid=0|padhgt=0|cellpad=10|txtalgn=center}} cellspacing="0"
|+ '''Example Table'''
|-
! Column
! Headers
|-
! Wide Row
| Wide example text
|-
! Note
| Alignment
|}
Which produces the following table:
| Column | Headers |
|---|---|
| Wide row | Wide example text |
| Note | Alignment |