Bản mẫu:Kiểu bảng
Usage
[sửa]This template allows shorthand table styling parameters. It supports up to 10 CSS style commands (e.g. "text-align:right;"), each bound to a shorthand code.
If you want to add a shorthand entry, add it to {{table style/parse}}.
Natural language codes that are not in the list of below, can be used in addition, or in combination with the shorthand codes.
- Natural language codes need to be terminated with the semicolon (;), while shorthand codes include the semicolon (;).
List of parameters
[sửa]When adding a new code, please insert here in alphabetic order
natural language code | shorthand | natural language |
table | row | cell | notes |
---|---|---|---|---|---|---|
background-color: transparent; | bgt
|
transparent | y | ? | y | |
border: 1px dotted black; | ba.
|
y | n | y | ||
border: 1px solid black; | ba
|
border all | y | n | y | |
border: 2px solid black; | ba2
|
y | n | y | ||
border: 3px solid black; | ba3
|
y | n | y | ||
border: 4px double black; | bad
|
y | n | y | ||
border-bottom: 1px dotted black; | bb.
|
y | n | y | ||
border-bottom: 2px dotted black; | bb2.
|
y | n | y | ||
border-bottom: 1px solid black; | bb
|
border bottom | y | n | y | |
border-bottom: 1px solid transparent; | bbt1
|
y | ? | y | ||
border-bottom: 2px solid black; | bb2
|
y | n | y | ||
border-bottom: 3px solid black; | bb3
|
y | n | y | ||
border-bottom: 4px double black; | bbd
|
y | n | y | ||
border-collapse: collapse; | bc
|
border collapse | n | y | n | |
border-left: 1px dotted black; | bl.
|
y | n | y | ||
border-left: 1px solid black; | bl
|
border left | y | n | y | |
border-left: 1px solid transparent; | blt1
|
y | ? | y | ||
border-left: 2px solid black; | bl2
|
y | n | y | ||
border-left: 3px solid black; | bl3
|
y | n | y | ||
border-left: 4px double black; | bld
|
y | n | y | ||
border-right: 1px dotted black; | br.
|
y | n | y | ||
border-right: 2px dotted black; | br2.
|
y | n | y | ||
border-right: 1px solid black; | br
|
border right | y | n | y | |
border-right: 1px solid transparent; | brt1
|
y | ? | y | ||
border-right: 2px solid black; | br2
|
y | n | y | ||
border-right: 3px solid black; | br3
|
y | n | y | ||
border-right: 4px double black; | brd
|
y | n | y | ||
border-top: 1px dotted black; | bt.
|
y | n | y | ||
border-top: 1px solid black; | bt
|
border top | y | n | y | |
border-top: 1px solid transparent; | btt1
|
y | ? | y | 'order: none' doesn't work on many browsers, use transparent instead | |
border-top: 2px solid black; | bt2
|
y | n | y | ||
border-top: 3px solid black; | bt3
|
y | n | y | ||
border-top: 4px double black; | btd
|
y | n | y | ||
direction: rtl; | rtl
|
? | ? | y | ||
float: left; | fll
|
float left | y | n | n | Breaks text flow. |
float: right; | flr
|
float right | y | n | n | Breaks text flow. |
font-family: sans-serif; | ffn
|
y | y | y | ||
font-family: serif; | ffs
|
y | y | y | ||
font-size: 58%; | xxs
|
xx-smaller | y | y | y | |
font-size: 69%; | xs
|
x-smaller | y | y | y | |
font-size: 80%; | sm80
|
y | y | y | ||
font-size: 83%; | sm
|
smaller | y | y | y | |
font-size: 85%; | sm85
|
y | y | y | ||
font-size: 90%; | sm90
|
y | y | y | ||
font-size: 92%; | sm92
|
y | y | y | equivalent to {{fine}} | |
font-size: 95%; | sm95
|
y | y | y | ||
font-size: 110%; | sm110
|
y | y | y | ||
font-size: 105%; | fs105
|
y | y | y | Used for PSM sub titles | |
font-size: 120%; | lg
|
larger | y | y | y | |
font-size: 144%; | xl
|
x-larger | y | y | y | |
font-size: 182%; | xxl
|
xx-larger | y | y | y | |
font-size: 207%; | 3xl
|
xxx-larger | y | y | y | |
font-size: 249%; | 4xl
|
xxxx-larger | y | y | y | |
font-style: italic; | fsi
|
italic | y | y | y | |
font-variant: small-caps; | sc
|
small caps | y | y | y | |
font-weight: bold; | fwb
|
bold | y | y | y | |
font-weight: normal; | fwn
|
normal | ? | y | y | Used to make something un-bold that is already bolded |
line-height: 100%; | lh1
|
y | y | y | ||
line-height: 100%; | lh10
|
|||||
line-height: 110%; | lh11
|
y | y | y | ||
line-height: 120%; | lh12
|
y | y | y | ||
line-height: 130%; | lh13
|
y | y | y | ||
line-height: 150%; | lh15
|
y | y | y | ||
line-height: 200%; | lh2
|
y | y | y | ||
line-height: 200%; | lh20
|
|||||
line-height: 95%; | lh95
|
y | y | y | ||
margin: 0 auto 0 auto; | mc
|
float | y | ? | y | |
margin: 10px; | ma10
|
y | ? | y | ||
margin: 5px; | ma5
|
y | ? | y | ||
margin-bottom: 10px; | mb10
|
y | ? | y | ||
margin-bottom: 5px; | mb5
|
y | ? | y | ||
margin-left: 10px; | ml10
|
y | ? | y | ||
margin-left: 5px; | ml5
|
y | ? | y | ||
margin-right: 10px; | mr10
|
y | ? | y | ||
margin-right: 5px; | mr5
|
y | ? | y | ||
margin-right: auto; margin-left: auto; | ma
|
y | ? | ? | ||
margin-top: 10px; | mt10
|
y | ? | y | ||
margin-top: 5px; | mt5
|
y | ? | y | ||
padding-bottom: 0.5em; | pb.5
|
y | n | y | ||
padding-bottom: 0; | pb0
|
y | n | y | ||
padding-bottom: 1.0em; | pb1
|
y | n | y | ||
padding-bottom: 1.5em; | pb15
|
y | n | y | ||
padding-bottom: 2.0em; | pb2
|
y | n | y | ||
padding-bottom: 3.0em; | pb3
|
y | n | y | ||
padding-bottom: 4.0em; | pb4
|
y | n | y | ||
padding-bottom: 5.0em; | pb5
|
y | n | y | ||
padding-left: 1.0em;text-indent: -1.0em; | it1
|
y | n | y | ||
padding-left: 1.5em; text-indent: -1.0em; | it1p.5
|
y | n | y | ||
padding-left: 2.0em; text-indent: -1.0em; | itp
|
y | n | y | ||
padding-left: 2.0em;text-indent: -2.0em; | it
|
y | n | y | ||
padding-left: 2.5em; text-indent: -2.0em; | itp.5
|
y | n | y | ||
padding-left: 3.0em; text-indent: -1.0em; | it1p2
|
y | n | y | ||
padding-left: 4.0em;text-indent: -2.0em; | it42
|
y | ? | y | PSM indent for literature section entries in the volume index. | |
padding-left: 0.5em; | pl.5
|
y | n | y | ||
padding-left: 0; | pl0
|
y | n | y | ||
padding-left: 1.0em; | pl1
|
y | n | y | ||
padding-left: 1.5em; | pl15
|
y | n | y | ||
padding-left: 2.0em; | pl2
|
y | n | y | ||
padding-left: 3.0em; | pl3
|
y | n | y | ||
padding-left: 3.5em; | pl3.5
|
y | n | y | ||
padding-left: 4.0em; | pl4
|
y | n | y | ||
padding-left: 5.0em; | pl5
|
y | n | y | ||
padding-left: 6.0em; | pl6
|
y | n | y | ||
padding-left: 7.0em; | pl7
|
y | n | y | ||
padding-right: 0.5em; | pr.5
|
y | n | y | ||
padding-right: 0; | pr0
|
y | n | y | ||
padding-right: 1.0em; | pr1
|
y | n | y | ||
padding-right: 1.5em; | pr15
|
y | n | y | ||
padding-right: 2.0em; | pr2
|
y | n | y | ||
padding-right: 3.0em; | pr3
|
y | n | y | ||
padding-right: 3.5em; | pr3.5
|
y | n | y | ||
padding-right: 4.0em; | pr4
|
y | n | y | ||
padding-right: 5.0em; | pr5
|
y | n | y | ||
padding-right: 6.0em; | pr6
|
y | n | y | ||
padding-right: 7.0em; | pr7
|
y | n | y | ||
padding-top: 0.5em; padding-bottom: 0.5em; | ptb.5
|
y | n | y | Padding title rows | |
padding-top: 1em; padding-bottom: 1em; | ptb1
|
y | n | y | ||
padding-top: 0.5em; | pt.5
|
y | n | y | ||
padding-top: 0; | pt0
|
y | n | y | ||
padding-top: 1.0em; | pt1
|
y | n | y | ||
padding-top: 1.5em; | pt15
|
y | n | y | ||
padding-top: 2.0em; | pt2
|
y | n | y | ||
padding-top: 3.0em; | pt3
|
y | n | y | ||
padding-top: 4.0em; | pt4
|
y | n | y | ||
padding-top: 5.0em; | pt5
|
y | n | y | ||
text-align: center; | ac
|
center | y | y | y | |
text-align: justify; | aj
|
justify | y | y | y | |
text-align: left; | al
|
left | y | y | y | |
text-align: right; | ar
|
right | y | y | y | |
text-decoration:line-through; | tds
|
strike | y | y | y | |
text-decoration:underline; | tdu
|
underline | y | y | y | |
text-transform: capitalize; | cap
|
capitalize | y | y | y | |
text-transform: lowercase; | lc
|
lower case | y | y | y | |
text-transform: uppercase; | uc
|
upper case | y | y | y | |
vertical-align: baseline; | vbs
|
baseline | y | y | y | |
vertical-align: bottom; | vbm
|
bottom | y | y | y | |
vertical-align: middle; | vmi
|
middle | y | y | y | |
vertical-align: text-bottom; | vtb
|
text bottom | y | y | n | Does not apply to table-cells[1] |
vertical-align: text-top; | vtt
|
text top | n | y | y | Does not apply to table-cells[2] |
vertical-align: top; | vtp
|
top | n | y | y | |
white-space: nowrap; | wnw
|
nowrap | ? | ? | y | |
width: 0%; | w0
|
narrow | y | n | y | |
width: 100%; | wa
|
full width | y | n | y | |
width: 100em; | w100
|
|||||
width: 15%; | w15
|
y | n | y | ||
width: 20%; | w20
|
fifth | y | n | y | |
width: 25%; | w25
|
quarter | y | n | y | |
width: 33%; | w33
|
third | y | n | y | |
width: 40%; | w40
|
two fifths | y | n | y | |
width: 50%; | w50
|
half | y | n | y | |
width: 60%; | w60
|
three fifths | y | n | y | |
width: 67%; | w67
|
two thirds | y | n | y | |
width: 75%; | w75
|
three quarters | y | n | y | |
width: 80%; | w80
|
four fifths |
Examples
[sửa]{{ts|ar|ba|sc}} produces style="text-align:right; border:1px solid black; font-variant:small-caps;"
{{table style|ar|vtb|pr2}} produces style="text-align:right; vertical-align:top; padding-right:2.0em;"
Natural language code combined with shorthand code:
[sửa]{{ts|text-align:right;|pr2}} produces style="text-align:right; padding-right:2.0em;"
Where to place the template in a table?
[sửa]Either at the start of the table, or on a row break, or for an individual cell.
In the following example the templates first sets the text in all the cells to be centered ({{ts|ac}}
). Then on the second row (after the heading row) all the text in the row to be left justified ({{ts|al}}
), finally the third row second column (the number of years) to be right justified ({{ts|ar}}
).
{|class="wikitable" {{ts|ac}} |- !Location !Number of years !Annual average rainfall in inches |- |Basra|||18||6-68 |-{{ts|al}} |Bagdad||29||6-64 |- ||Mosul||{{ts|ar}}|4||16-71 |}
Display as:
Location | Number of years | Annual average rainfall in inches |
---|---|---|
Basra | 18 | 6-68 |
Bagdad | 29 | 6-64 |
Mosul | 4 | 16-71 |