Wikisource:Style guide/Tables

From Wikisource
Jump to: navigation, search
Wikisource:Style guide Tables
Some styles used to enable easier formatting consistency of tables

Basic table[edit]

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 formatting[edit]

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

Classes[edit]

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

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

prettytable[edit]

  • 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.

valign[edit]

  • Table row
    • vertically align rows top

valignb[edit]

  • Table row
    • vertically align rows bottom

table-c75vtop[edit]

  • Table body
    • table centred
    • 75% width
  • Table row
    • vertically aligned to top

Example:

{| class="table-c75vtop"
|-
| {{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.

tablecolhdborder[edit]

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

  • Table body
    • border:1px solid; margin:0 0 0 0;
    • 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

messagebox[edit]

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.

headertemplate[edit]

Example:

{| class="headertemplate"
|-
| {{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.