9 Table element
Tables are excellent for presenting structured information, but that capability makes them more involved to set up.
Table structure△
Tables are a two-dimensional array of cells, but are constructed as rows of cells.
# | Year | Rate % | Comments |
---|---|---|---|
1 | 2020 | 15.6 | Covid-19 in full swing without vaccines available |
2 | 2021 | 9.8 | More virulent strains but vaccines kept it under control |
– | Mean | 12.7 | Will be long-term effects |
The column alignments are Centre for
Table Content ┣━ Introduction ┃ └─ Text A sample table with top and side headings, two rows and … ┣━ Header ┃ ├─ Heading Year ┃ ├─ Heading Rate % ┃ └─ Heading Comments ┣━ Row ┃ ├─ Label 2020 ┃ ├─ Cell 15.6 ┃ └─ Cell Covid-19 in full swing without vaccines available ┣━ Row ┃ ├─ Label 2021 ┃ ├─ Cell 9.8 ┃ └─ Cell More virulent strains but vaccines kept it under control ┗━ Footer ├─ Label Mean ├─ Label 12.7 └─ Label Will be long-term effects
# | Option | Description | Result of changing to |
---|---|---|---|
a | Top | Labels are shown for column headings | Any previous side labels and their contents are deleted |
b | Side | Labels are shown for row headings | All top labels contents are deleted and they are hidden |
c | Both | Labels are shown as column and row headings | Missing heading labels will have to be specified |
Changing the header location will alter what happens to the header cells. For example, changing from Both or Top to Side will delete the content of the top headings and they will not be visible when rendered, but will still show while editing. Changing from Both or Side to Top will delete the side heading column cells altogether.
# | Option | Description |
---|---|---|
1 | None | No number column is shown |
2 | Alphabetic | Number column is shown with letter of the alphabet. For when order is not important, but each row has an identifier for reference |
3 | Ascending | Number column is shown with numerals starting with 1 at the top. For where order is important |
4 | Descending | Number column is shown with numerals starting with 1 at the bottom. Typically for when the number indicates the order of creation or release, but the latest needs to be at the top |
For numbering options other than None, clicking on any row's numbering column will jump to the first letter of its introduction. However, if the table's
Tables are automatically laid out according to the layout direction of the current locale, hence the use of Start and End to specify alignment in a locale-independent way. However, Left and Right are also provided to force those alignments, regardless of locale.
Header△
The header row holds the column headings, though not all tables require visible headings on top.
# | Option | Description |
---|---|---|
a | Start | Biased towards the start of the cell |
b | Centre | Centred in the cell. Use only if all values are short and of similar size |
c | End | Biased towards the end of the cell |
d | Number | Biased to align numbers according to the locale, but not to the decimal mark. If wanting decimal alignment, ensure each value in the column has the same number of decimal places |
e | Left | Biased towards the left of the cell |
f | Right | Biased towards the right of the cell |
g | Wide | Force the table to occupy 100% of the width of the page by maximising the column width. Only available for one column |
The
Tables are tricky because each column will only shrink to its longest content word, and if there are too many columns, the table may be forced to overflow beyond the page border. The automatic hyphenation may help here, but not all browsers support that or for all languages, so embedding a soft hyphen may be needed.
Wide forces the table to expand to the page width, which can be aesthetically more pleasing for a fairly empty table than having a wide space beside the table. However, it also forces every other column to maximally wrap, so using breaks in conjunction with the
Using Wide for highly variable-length content like descriptions in the last column is best, but only if it is the only such column, otherwise do not use Wide and let the browser work out the right balance of wrapping between those columns, especially if there will always be at least one cell that has wrapping text that forces the table to be full width anyway, or use the table's
Table introductions will wrap around at the table width, so if using long introductions with a narrower table, to avoid excessive wrap-around, turn on the table's
Row△
Each row contains the actual information that the table is meant to provide.
There can be up to 19 rows, and their cells are rich text elements, except a side heading column has only plain text labels. The side heading label is like a heading and must have text.
Footer△
The optional footer contains summary information.
There is only ever one footer, and it contains only
Linking to figures△
A table can be linked to a figure to provide descriptions and other information for its labels.
See Linking to figures in
Limitations△
Some limits are placed upon how large tables can be to keep them presentable.
Theoretically, tables in pages can be embedded within a table cell to any depth. However, one of the limitations of tables is that a cell's minimum width is defined by the longest word in its content. If there are too many columns, too many cells with long words, or an embedded table, the table will likely overflow past the ending boundary of the page, especially if viewed on a phone in portrait mode.
This can be mitigated for embedded tables by very careful design for particular types of information, and educating users, such as the recommendation to use a larger device like a tablet when managing and editing a Smallsite Design site. However, for general visitors, such information density is likely to overwhelm all but the most dedicated spreadsheet users. This is why in Smallsite Design, tables cannot be embedded nor allow more than six columns, excluding any numbering column.
If table content starts to look too complex, it should be broken out into multiple tables or other elements like lists to show different parts of the information. This process may also help with eliminating repeated information in the same way normalisation does for databases by breaking a large monolithic record structure into less complex records.
For example, if one column contains unique values, the table could be broken into two tables, each starting with that column, but the remaining columns are split between them. Alternately, if some cells contain complex information, that content can be in another
There must be at lease one row, and up to 19 maximum. The latter is to limit the width of the numbering column, which is recommended to have for all but the very shortest tables because it provides easy visual referencing of rows as well as easier navigation for keyboard users.