Wikipedia:Manual of Style/Tables

From Wikipedia, the free encyclopedia

Tables are a way of presenting information in rows and columns. They can be useful for a variety of content presentations on Wikipedia, but should be used only when appropriate; sometimes the information in a table may be better presented as prose paragraphs or as an embedded list.

Avoid referring to tables as being located on the left or right of a display page. Placement is different for viewers of the mobile versions of Wikipedia, and is meaningless to people having pages read to them by assistive software. Instead, use captions to identify tables.

Formatting[edit]

It is recommended that wikitables be used in place of HTML tables, as they are easier to customize and maintain. A standard "wikitable style" is available, by adding class="wikitable" to the top row of the table. The powerful and useful sorting feature can be enabled by adding class="sortable" to the top row. Extreme caution should be applied if rowspan or colspan is used. It is also possible to combine classes, as in class="wikitable sortable".

Captions and headers[edit]

Table captions and column and row headers should be succinct and self explanatory. In most cases, individual words or sentence fragments should be used, and thus articles (a, an, the) and sentence-ending punctuation are unnecessary. Only the first word in the caption or header should be capitalized (except for proper nouns), in keeping with Wikipedia's conventions for capital letters. In some rare cases, judicious use of soft hyphens may be helpful (see WP:Manual of Style#Hyphens for details).

Much of WP:Manual of Style § Article titles, headings, and sections also pertains to table headers: Use sentence case; avoid redundantly including the subject's name in a header; do not put images in the header (including flag icons), unless this is the best way to present tabular information in a particular case; and do not use questions as headers. Title headers are often suitable places for reference citations (e.g., to source a specific row or column of data). Unlike section headings, they often begin with or consist entirely of numbers (such as model numbers, dates, version numbers, etc.). Table headers do not automatically generate link anchors the way section headings do; use the {{vanchor}} template to turn a header's text (or part of it) into an anchor.

Appearance[edit]

In general, styles for tables and other block-level elements should be set using CSS classes, not with inline style attributes. This is because the site-wide CSS is more carefully tested to ensure compatibility with a wide range of browsers; it also creates a greater degree of professionalism by ensuring a consistent appearance between articles. Deviations from standard conventions are acceptable where they create a semantic distinction (for instance, the infoboxes and navigational templates relating to The Simpsons use a yellow color-scheme instead of the customary mauve, to tie in with the dominant color in the series) but should not be used gratuitously.

See WP:Deviations and Wikipedia talk:Consensus/RfC for guidance on use of coloring or non-standard formatting, and for when MoS and WikiProjects guidance is at variance.

Consideration may be given to collapsing tables which consolidate information covered in the prose.

Accessibility[edit]

Screen readers and other web browsing tools make use of specific table tags to help users navigate the data contained within tables. Use the correct wikitable pipe syntax to take advantage of all the features available.

See MOS:COLOR for information about restrained use of color in tables, to avoid creating accessibility problems for visually-impaired as well as normal vision readers.

Do not separate items by leaving blank lines between them, even when using unordered or definition lists. The Wikipedia list templates explicitly identify lists for readers, rather than relying on visual formatting to indirectly imply the presence of a list.

Size[edit]

Splitting lists and tables per summary style is advised against. Among other problems, arbitrarily splitting a wikitable effectively disables the powerful and useful sorting feature from working across the entire table.

On the other hand, overloading tables with too much detailed statistical data is against policy. Careful thought should be given to how a reader would use a table, and what level of detail is appropriate.

Appropriate use[edit]

Tables are a way of presenting links, data, or information in rows and columns. They are a complex form of list, formatted into a systematic grid pattern. Tables might be useful for presenting mathematical data such as multiplication tables, comparative figures, or sporting results. They may also be useful for presenting equivalent words in two or more languages; for awards by type and year; complex discographies; etc.

The sortability of multiple columns in a table is a powerful tool that helps the reader to understand relationships and find patterns in large lists. The sortability of tables makes them very useful for "List of..." articles in Wikipedia, which are intended to give an overview of the subject area, and to allow easy comparisons among many similar items. Avoid cramming too much detailed information into individual table entries; if appropriate, the reader should be able to click a Wikilink to read a full, detailed article corresponding to a concise table entry.

Often a list is best left as a list. Before reformatting a list into table form, consider whether the information will be more clearly conveyed by virtue of having rows and columns. If so, then a table is probably a good choice. If there is no obvious benefit to having rows and columns, then a table is probably not the best choice.

Tables should not be misused to resolve visual layout problems. If the information you are editing is not tabular in nature, it probably does not belong in a table: Do not misuse tables for putting a caption under a photograph, arranging a group of links, or other strictly visual features. These practices make the article harder for other Wikipedians to edit, and will likely cause problems when viewed on different display sizes and aspect ratios. Also, when compared with tables, wikimarkup is more flexible, easier to use, and less arcane when used correctly for desktop publishing layout, page elements, and page orientation and positioning.

Examples:

Multi-column sortable standard[edit]

Sporting results
OutcomeNo.YearChampionshipOpponent in the finalScoreRef
Winner11981World ChampionshipWales Doug Mountjoy18–12[1]
Winner21983World Championship (2)Canada Cliff Thorburn18–6[1]
Winner31983International OpenCanada Cliff Thorburn9–3[2]
Winner41984ClassicEngland Tony Meo9–8[3]
Winner51984World Championship (3)England Jimmy White18–16[1]
Winner61984International Open (2)England Tony Knowles9–2[2]
Winner71984UK ChampionshipNorthern Ireland Alex Higgins16–8[4]
Runner-up11985World ChampionshipNorthern Ireland Dennis Taylor17–18[1]
Winner81985Grand PrixNorthern Ireland Dennis Taylor10–9[1]
Winner91985UK Championship (2)England Willie Thorne16–14[4]

Multi-column standard with subcolumns[edit]

Discographies
YearTitlePeak chart positionsCertifications
CANAUSAUTGERNLDNORSWESWIUKUSNorth AmericaEurope
1993So Far So Good
  • Released: November 2, 1993
  • Label: A&M
2
[5]
111111116CA: 6× Platinum
US: 5× Platinum
SW: 4× Platinum
UK: 3× Platinum
1999The Best of Me
  • Released: November 15, 1999
  • Label: A&M
14184713220312CA: 3× PlatinumEU: 2× Platinum[6]
SW: Platinum
UK: Platinum
2005Anthology
  • Released: October 18, 2005
  • Label: A&M
42830392965CA: 2× PlatinumUK: Gold
2010Icon
"—" denotes releases that did not chart.

Multi-column mixed sortable unsortable[edit]

Filmographies
List of acting performances in film and television
YearTitleRoleNotes
1961BarabbasPatrician in Arenauncredited
1962Hemingway's Adventures of a Young Manundetermined roleuncredited
1963Beverly Hillbillies, TheThe Beverly HillbilliesJanet TregoTV series, 15 episodes
1963Mister Ed
  • Telephone Operator
  • Sailor's Girl
  • TV series, episodes:
  • "Love Thy New Neighbor"
  • "Ed Discovers America"
1964Americanization of Emily, TheThe Americanization of EmilyBeautiful Girluncredited
1965Man from U.N.C.L.E., TheThe Man from U.N.C.L.E.TherapistTV series, episode: "The Girls of Nazarone Affair"
1966Eye of the DevilOdile de Caray
1967Fearless Vampire Killers, TheThe Fearless Vampire KillersSarah Shagal
1967Don't Make WavesMalibu
1967Valley of the DollsJennifer North
1968Rosemary's BabyGirl at Partyuncredited
1968Wrecking Crew, TheThe Wrecking CrewFreya Carlson
1969Thirteen Chairs, TheThe Thirteen Chairs
(also known as 12+1)
Patreleased posthumously

Multi-column unsortable[edit]

Multi-column unsortable all numeric right justified[edit]

Mathematical tables
Multiplication table
×12345678910
112345678910
22468101214161820
336912151821242730
4481216202428323640
55101520253035404550
66121824303642485460
77142128354249566370
88162432404856647280
99182736455463728190
10102030405060708090100

Tree (cladogram) left rooted[edit]

Gant (bar graph linear horizontal) with color[edit]

Flow data

Inappropriate use[edit]

Simple lists[edit]

If a list is simple, it is generally better to use one of the standard Wikipedia list formats instead of a table. Lists are easier to maintain than tables, and are often easier to read.

Here is an example of a simple list using list formatting:

* 1980: Ultra Wave* 1988: What's Bootsy Doin'?* 1994: Blasters of the Universe* 1994: Fresh Outta 'P' Uni

Which produces:

  • 1980: Ultra Wave
  • 1988: What's Bootsy Doin'?
  • 1994: Blasters of the Universe
  • 1994: Fresh Outta 'P' Uni

versus table formatting:

{|| 1980| Ultra Wave|-| 1988| What's Bootsy Doin'?|-| 1994| Blasters of the Universe|-| 1994| Fresh Outta 'P' Uni|}

Which produces:

1980Ultra Wave
1988What's Bootsy Doin'?
1994Blasters of the Universe
1994Fresh Outta 'P' Uni

Prose[edit]

Prose is preferred in articles as prose allows the presentation of detail and clarification of context, in a way that a table may not. Prose flows, like one person speaking to another, and is best suited to articles, because their purpose is to explain. Tables which are mainly links, which are most useful for browsing subject areas, should usually have their own entries: see Wikipedia:Stand-alone lists for detail. In an article, significant items should normally be mentioned naturally within the text rather than merely tabulated.

Page layout[edit]

Page layouts (using multiple columns, positioning elements, adding borders, etc.) should be done via CSS, not tables, whenever possible.

  • Images and other embedded media should be positioned using standard image syntax.
  • There are several templates available that will create preformatted multi-column layouts: see Help:Columns.
  • Other elements can be positioned or given special formatting through the use of the HTML <div> element and CSS styling.

Sidebars and Infoboxes[edit]

While tables used to be the only way to display information in a sidebar or infobox, the addition of Modules has eliminated that need. When creating an Infobox or Sidebar, the appropriate templates should be used. For an infobox, {{Infobox}} or {{Infobox3cols}}, unless a more specific template already exist. For sidebars, {{Sidebar}} or {{Sidebar with collapsible lists}} are a good foundation. Direct table-based layout should not be used.

See also[edit]

References[edit]

  1. ^ a b c d e Turner, Chris. "World Professional Championship". cajt.pwp.blueyonder.co.uk. Chris Turner's Snooker Archive. Retrieved 18 March 2011. 
  2. ^ a b Turner, Chris. "International Open Goya, Matchroom Trophy". cajt.pwp.blueyonder.co.uk. Chris Turner's Snooker Archive. Retrieved 18 March 2011. 
  3. ^ Turner, Chris. "Classic". cajt.pwp.blueyonder.co.uk. Chris Turner's Snooker Archive. Retrieved 18 March 2011. 
  4. ^ a b Turner, Chris. "UK Championship". cajt.pwp.blueyonder.co.uk. Chris Turner's Snooker Archive. Retrieved 18 March 2011. 
  5. ^ "Top Albums/CDs – Volume 58, No. 25". RPM (Library and Archives Canada). January 10, 1994. Retrieved August 15, 2010. 
  6. ^ "IFPI Platinum Europe Awards: 2002 Awards". International Federation of the Phonographic Industry (IFPI) – Europe. Retrieved August 15, 2010.