• New article from the Springfield Shopper: Krusty’s aunt helps repair Homer’s relationship with Patty and Selma this December!
  • Wikisimpsons needs more Featured Article, Picture, Quote, Episode and Comprehensive article nominations!
  • Wikisimpsons has a Discord server! Click here for your invite! Join to talk about the wiki, Simpsons and Tapped Out news, or just to talk to other users.
  • Make an account! It's easy, free, and your work on the wiki can be attributed to you.
TwitterFacebookDiscord

Help:Table markup

Wikisimpsons - The Simpsons Wiki
Revision as of 17:57, September 18, 2014 by Solar Dragon (talk | contribs) (Customization)
Incomplete.png This article or section is incomplete.


Please improve the article, or discuss the issue on the talk page.

This page is a tutorial on how to use tables.

How to make a table

Basic tables

The most basic form of table is a simple one item per box table. For example:

{{Table|
{{TH|A}}
{{TH|B}}
{{TH|C}}
{{TBT|1}}
{{TB|2}}
{{TB|3}}
{{TBT|4}}
{{TB|5}}
{{TB|6}}
}}

Makes:

A B C
1 2 3
4 5 6

{{TH}} is for headers, {{TBT}} starts new rows and {{TB}} is for other cells in a row. Also, {{THT}} can be used to start a new row of headers if need be.

Colspans and rowspans

Colspans and rowspans are used for spanning a cell between columns and rows respectively. Both headers and content can use colspans and rowspans.

Colspan

Colspans span across the table horizontally.

Headers:

The code for a colspan header is {{TH|<header name>|colspan=X}} where <header name> is the name of the the header and X is the number of columns you want it to span. {{THT}} can also be subbed into this template.

Content:

The code for a colspan content area is {{TCs|<content>|X}} where <content> is the content of the cell and X is the number of columns you want it to span. {{TCsT}} can also be subbed into this template if you want to colspan the start of a new row.

Example:

{{Table|
{{TH|This spans two columns|colspan=2}}
{{TH|This is one column}}
{{TBT|This is one column}}
{{TB|This is one column}}
{{TB|This is one column}}
{{TCsT|This spans two columns|2}}
{{TB|This is one column}}
}}
This spans two columns This is one column
This is one column This is one column This is one column
This spans two columns This is one column

Rowspan

Rowspans span across the table vertically.

Headers:

The code for a rowspan header is {{TH|<header name>|rowspan=X}} where <header name> is the name of the the header and X is the number of rows you want it to span. {{THT}} can also be subbed into this template.

Content:

The code for a rowspan content area is {{TRs|<content>|X}} where <content> is the content of the cell and X is the number of rows you want it to span. {{TRsT}} can also be subbed into this template if you want to colspan the start of a new row.


Example:

{{Table|
{{TH|This spans two rows|rowspan=2}}
{{TH|This is one row}}
{{TH|This is one row}}
{{TBT|This is the first element, but is in the second column}}
{{TRs|This spans two rows|2}}
{{TBT|This is one row}}
{{TB|This is one row}}
}}
This spans two rows This is one row This is one row
This is the first element, but is in the second column This spans two rows
This is one row This is one row

Colspan and rowspan in the same cell

Occasionally, you may need to have a cell span multiple rows and columns.

Headers:

The code for colspan and rowspan headers is {{TH|<header name>|colspan=X|rowspan=Y}} where <header name> is the name of the the header, X is the number of columns you want it to span and Y is the number of rows you want it to span. {{THT}} can also be subbed into this template.

Content:

The code for colspan and rowspan headers is {{TCRs|<content>|Y|X}} where <content> is the content of the cell, X is the number of columns you want it to span and Y is the number of rows you want it to span. {{TCRsT}} can also be subbed into this template.


Example:

{{Table|
{{TH|This spans two rows and two columns|colspan=2|rowspan=2}}
{{TH|This is one row in one column}}
{{TH|This is one row in one column}}
{{TH|This is one row in one column}}
{{TBT|This is one row in one column}}
{{TCRs|This spans two rows and two columns|2|2}}
{{TBT|This is one row in one column}}
{{TB|This is one row in one column}}
{{TB|This is one row in one column}}
}}
This spans two rows and two columns This is one row in one column This is one row in one column This is one row in one column
This is one row in one column This spans two rows and two columns
This is one row in one column This is one row in one column This is one row in one column

Customization

Tables can be customized to get them looking how you want, or to add some features in.

Content color

Content color is is main one. Headers remain the same color all the time and can not be changed. Content can though. All you need to do is add the parameter |color=#COLORCODE or |color=COLORNAME into the template, where COLORCODE is the code for the color and COLORNAME is the color name (i.e. red, blue or white).

Example:

{{Table|
{{TH|Header 1}}
{{TH|Header 2}}
{{TBT|Content 1|color=#2EFE64}}
{{TB|Content 2|color=blue}}
}}
Header 1 Header 2
Content 1 Content 2

Font color

Font color can also be changed in content areas only. To do this, add the parameter |font color=#COLORCODE or |font color=COLORNAME into the template, where COLORCODE is the code for the color and COLORNAME is the color name (i.e. red, blue or white).

Example:

{{Table|
{{TH|Header 1}}
{{TH|Header 2}}
{{TBT|Content 1|font color=#2EFE64}}
{{TB|Content 2|font color=blue}}
}}
Header 1 Header 2
Content 1 Content 2

Sortable

Tables can be made sortable, by numerical value or alphabetical. To do this, you need to add |sortable=yes into the main Table template.

Example:

{{Table|sortable=yes|
{{TH|Numbers}}
{{TH|Letters}}
{{TBT|8}}
{{TB|T}}
{{TBT|5}}
{{TB|B}}
{{TBT|0}}
{{TB|P}}
{{TBT|3}}
{{TB|E}}
}}
Numbers Letters
8 T
5 B
0 P
3 E