Tables

From AGI Wiki
Jump to navigationJump to search

With the limitations of the Wiki software, sometimes it may be necessary to fall back on the use of tables to arrange content on the page in the desired location where normally this would be handled by the use of CSS. However, please try to avoid the use of tables where possible. Try to reserve their use for tabular data.

Wiki Table Tags

Wiki tags for tables are as follows:

Table: {|
Row: |-
Header Cell: !
Cell: |
Table closing tag: |}


No closing tag for table rows or cells are needed. Be sure to add the closing table tag at the end of your table. Normal attributes can be added, such as width, borders, positioning, cellpadding and cell spacing.

{| width="800"

will create a table that is 800px wide. Cells in the same table row can be combined on the same line if separated by a double pipe "||"

| Cell1 || Cell2 || Cell3

Table and Cell Attributes

Multiple attributes can be used by separating them with a space:

{| cellpadding="10"

When adding attributes to cells, separate attribute from the data with a single pipe, "|".

| align="center" | Cell Data

Table Borders and Styles

For tables with borders, start your table with {| class="wikitable". This will automatically add borders and keep consistency in style through out the Wiki.

{| class="wikitable" width="400"
|-
!Column1 !! Column2 !! Column3
|-
| align="center" | Cell1 || align="center" | Cell2 || align="center" | Cell3
|-
| align="center" | Cell4 || align="center" | Cell5 || align="center" | Cell6
|}

Will create a table 400px wide, 3 columns by 3 rows with a border of 1.

Column1 Column2 Column3
Cell1 Cell2 Cell3
Cell4 Cell5 Cell6

Sortable Tables

Tables can be made sortable by adding the "sortable" class to the opening table tag {| class="wikitable sortable"

{| class="wikitable sortable" width="400"
|-
!Column1 !! Column2 !! Column3 !! Column4
|-
| align="center" | Cell1 || align="center" | Cell2 || align="center" | Cell3 || align="center" | Cell4
|-
| align="center" | Cell5 || align="center" | Cell6 || align="center" | Cell7 || align="center" | Cell8
|-
| align="center" | Cell9 || align="center" | Cell10 || align="center" | Cell11 || align="center" | Cell12
|}

Will produce:

Column1 Column2 Column3 Column4
Cell1 Cell2 Cell3 Cell4
Cell5 Cell6 Cell7 Cell8
Cell9 Cell10 Cell11 Cell12

For more help with tables, see MediaWiki's Help with tables.