• New article from the Springfield Shopper: Season 36 News: A new episode title, “Homer and Her Sisters”, has been announced!
  • 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

Difference between revisions of "Help:Table markup"

Wikisimpsons - The Simpsons Wiki
(How to make a table)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Incomplete}}
+
This page is a tutorial on how to use '''Table markup'''. Wikisimpsons uses a series of templates to create tables as it is very heavy on code and can take up a lot of space on articles. All the templates used and how to use them are listed below.
This page is a tutorial on how to use tables.
 
  
 
== How to make a table ==
 
== How to make a table ==
Line 146: Line 145:
 
{{TB|This is one row in one column}}
 
{{TB|This is one row in one column}}
 
{{TB|This is one row in one column}}
 
{{TB|This is one row in one column}}
 +
}}
 +
 +
=== Headers in other parts of the table ===
 +
Headers can be placed elsewhere in a table, as a subheader or otherwise.
 +
 +
'''Example:'''
 +
 +
<pre>
 +
{{Table|
 +
{{TH|Top header}}
 +
{{TH|Top header}}
 +
{{TH|Top header}}
 +
{{TBT|Content}}
 +
{{TH|Second row header}}
 +
{{TB|Content}}
 +
{{THT|Third row header}}
 +
{{TB|Content}}
 +
{{TH|Third row header}}
 +
}}
 +
</pre>
 +
 +
{{Table|
 +
{{TH|Top header}}
 +
{{TH|Top header}}
 +
{{TH|Top header}}
 +
{{TBT|Content}}
 +
{{TH|Second row header}}
 +
{{TB|Content}}
 +
{{THT|Third row header}}
 +
{{TB|Content}}
 +
{{TH|Third row header}}
 
}}
 
}}
  
Line 193: Line 223:
 
}}
 
}}
  
 +
=== Sortable ===
 +
Tables can be made sortable, by numerical value or alphabetical. To do this, you need to add <code>|sortable=yes</code> into the main Table template.
 +
 +
'''Example:'''
 +
 +
<pre>
 +
{{Table|sortable=yes|
 +
{{TH|Numbers}}
 +
{{TH|Letters}}
 +
{{TBT|8}}
 +
{{TB|T}}
 +
{{TBT|5}}
 +
{{TB|B}}
 +
{{TBT|0}}
 +
{{TB|P}}
 +
{{TBT|3}}
 +
{{TB|E}}
 +
}}
 +
</pre>
 +
 +
{{Table|sortable=yes|
 +
{{TH|Numbers}}
 +
{{TH|Letters}}
 +
{{TBT|8}}
 +
{{TB|T}}
 +
{{TBT|5}}
 +
{{TB|B}}
 +
{{TBT|0}}
 +
{{TB|P}}
 +
{{TBT|3}}
 +
{{TB|E}}
 +
}}
  
  
 
{{Help}}
 
{{Help}}

Latest revision as of 18:03, September 18, 2014

This page is a tutorial on how to use Table markup. Wikisimpsons uses a series of templates to create tables as it is very heavy on code and can take up a lot of space on articles. All the templates used and how to use them are listed below.

How to make a table[edit]

Basic tables[edit]

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

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

Colspan[edit]

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

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

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

Headers in other parts of the table[edit]

Headers can be placed elsewhere in a table, as a subheader or otherwise.

Example:

{{Table|
{{TH|Top header}}
{{TH|Top header}}
{{TH|Top header}}
{{TBT|Content}}
{{TH|Second row header}}
{{TB|Content}}
{{THT|Third row header}}
{{TB|Content}}
{{TH|Third row header}}
}}
Top header Top header Top header
Content Second row header Content
Third row header Content Third row header

Customization[edit]

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

Content color[edit]

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

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

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