Templat:Table alignment/doc
Tampilan
| Ini adalah sebuah subhalaman dokumentasi untuk Templat:Table alignment. Templat ini berisi informasi penggunaan, kategori dan konten lainnya yang bukan merupakan bagian dari templat halaman. |
Lua error in Modul:TNT at line 159: Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Uses TemplateStyles.tab.
Purpose
[sunting sumber]To make it simpler to align the columns in tables with less wikicode.
Usage
[sunting sumber]Place {{Table alignment}} just before the table and then add some classes to the table.
| classname | Purpose |
|---|---|
defaultleft |
Align all table cells left by default |
defaultcenter |
Align all table cells center by default |
defaultright |
Align all table cells right by default |
colNleft |
Align the cells in column N left, where N is a number |
colNcenter |
Align the cells in column N center, where N is a number |
colNright |
Align the cells in column N right, where N is a number |
Limitations
[sunting sumber]- Column numbers up to
col19are supported. A table can have more columns but they cannot be aligned with this method. - On tables using
rowspanorcolspan, using the classes may not work well on those rows because the alignment appears in wrong cells. Normal table code likestyle="text-align: left/center/right;"| cell contentcan be added to individual cells, both to get the wanted alignment and override unwanted alignment. - Does not work with {{static row numbers table}}. So remove that template and use code directly. For example: <syntaxhighlight lang=wikitext>
Templat:Static row numbersTemplat:Mw-datatable
</syntaxhighlight>- See example table with above wikitext.
Example
[sunting sumber]<syntaxhighlight lang="wikitext">
| Item1 | Item2 | Item3 | Item4 |
|---|---|---|---|
| AAAAAA | 100-200 | 3-4 | 53.43 |
| BBB | 5-6 | 7-8 | 5563.35 |
| CC | 9-10 | 113-125 | 322313.00 |
</syntaxhighlight>
| Item1 | Item2 | Item3 | Item4 |
|---|---|---|---|
| AAAAAA | 100-200 | 3-4 | 53.43 |
| BBB | 5-6 | 7-8 | 5563.35 |
| CC | 9-10 | 113-125 | 322313.00 |