Open main menu

Wikisource:Style guide/Tables

Basic tableEdit

A plain table, without borders. A common use is to reproduce a work's table of contents.

{| width=100%
|-
|Chapter 1
|align=right|1
|-
|Chapter 2
|align=right|17
...
|-
|Chapter 27
|align=right|371
|}

Shortcut formattingEdit

To enable a shortcut in the complexity of tables, and how they look in wikitext format, we have created the template:Table style.

ClassesEdit

To use one of the following classes in a wikitable, formatting takes the form

{| class="classname"
|-
...
|}

prettytableEdit

  • Table body
    • Greytable cells (#f9f9f9;)
    • margin: 1em 1em 1em 0;
    • border: 1px #aaa solid;
    • border-collapse: collapse;
  • Header row
    • padding: 0.2em;
    • border: 1px #aaa solid;
    • background-color: #f2f2f2;
    • text-align: center;
  • Cells
    • padding: 0.2em;
    • border: 1px #aaa solid;

Example:

{| class="prettytable"
|-
| {{lorem ipsum}}
|}

produces:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

valignEdit

  • Table row
    • vertically align rows top

valignbEdit

  • Table row
    • vertically align rows bottom

table-c75Edit

  • Table body
    • table centred
    • 75% width

Example:

{| class="table-c75"
|-
| {{lorem ipsum}}
|}

produces:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

tablecolhdborderEdit

1 px black solid border around table/columns/th; centre th; td align left with padding

  • Table body
    • border:1px solid; margin:0 auto 0 auto;
    • border-collapse:collapse;
  • Table header
    • border-bottom: 1px solid;
    • border-left: 1px solid;
    • text-align: center;
  • Cells
    • text-align:left;
    • border-left: 1px solid;
    • padding-left: 5px;

Example:

{| class="tablecolhdborder"
|-
| {{lorem ipsum}}
|}

produces:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Another example:

{| class="tablecolhdborder"
|-
!header 1 ||header 2 || h 3
|-
| Row 1, column 1  || Row 1, column 2 || Row 1, column 3
|-
| Row 2, column 1  || Row 2, column 2 || R 2, c 3
|}

produces:

header 1 header 2 h 3
Row 1, column 1 Row 1, column 2 Row 1, column 3
Row 2, column 1 Row 2, column 2 R 2, c 3

messageboxEdit

Example:

{| class="messagebox"
|-
| {{lorem ipsum}}
|}

produces:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

subheadertemplateEdit

Example:

{| class="subheadertemplate"
|-
| {{lorem ipsum}}
|}

produces:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.