User:Gaia Octavia Agrippa/Adoption/Tables

Tables are important additions to wikipedia articles. Adding a table can take an article up from a start class article to a B-class article. Tables can be very simple or rather complex in the way they are made, however I will only show you the more simple tables because that is all you need to know for now.

Formatting

edit

The most basic table

edit

The most basic table using the following code:

{|
|-
| row 1, column 1 || row 1, column 2
|-
| row 2, column 1 || row 2, column 2
|}

OR (You can use either, they produce the same table)

{|
|-
| row 1, column 1
| row 1, column 2
|-
| row 2, column 1
| row 2, column 2
|}
This produces the following table
row 1, column 1 row 1, column 2
row 2, column 1 row 2, column 2
Looking at the code needed to produce this table you can see
  • {| = Start of table
  • |} = End of table
  • |- = New row of table
  • | = New column

The table that would normally be used

edit

The following code can be accessed through the tool bar and is the table code most used around wikipedia.

{| class="wikitable" border="1"
|-
! header 1
! header 2
! header 3
|-
| row 1, column 1
| row 1, column 2
| row 1, column 3
|-
| row 2, column 1
| row 2, column 2
| row 2, column 3
|}
This produces
header 1 header 2 header 3
row 1, column 1 row 1, column 2 row 1, column 3
row 2, column 1 row 2, column 2 row 2, column 3
You will see that there are a couple of new editions
  • class="wikitable" border="1" = This produces the border that surrounds the text
  • ! = This produces a header for a column

Occasionally used

edit

This is a table that is used when multiple tables are shown next to each other and therefore require a heading each.

{| class="wikitable" border="1"
|+ Table heading
|-
! header 1
! header 2
! header 3
|-
| row 1, cell 1
| row 1, cell 2
| row 1, cell 3
|-
| row 2, cell 1
| row 2, cell 2
| row 2, cell 3
|}
This produces
Table heading
header 1 header 2 header 3
row 1, cell 1 row 1, cell 2 row 1, cell 3
row 2, cell 1 row 2, cell 2 row 2, cell 3
You will see a new additon
  • |+ = the table heading

When to use

edit

You should use tables when list has too many extras. For example

Use for sports results
Relegated teams from the Championship
Season Clubs
2004-05 Gillingham, Nottingham Forest, Rotherham United
2005-06 Crewe Alexandra, Millwall, Brighton & Hove Albion
2006-07 Southend United, Luton Town, Leeds United
2007-08 Leicester City, Scunthorpe United, Colchester United
2008-09 Charlton Athletic, Southampton, Norwich City
Use for awards won
List of wins and nominations
Year Award Group Result Film/TV show
2004 Teen Choice Award Choice TV Chemistry Nominated The O.C.
Choice Breakout TV Star - Male Nominated
Choice TV Show - Drama/Action Adventure Won
Choice TV Actor: Drama Won
Choice Breakout TV Show Won
TCA Award Outstanding New Program Nominated
2005 Teen Choice Award Choice TV Actor - Drama/Action Adventure Won
Choice Breakout TV Star - Male Won
Choice TV Chemistry (with Mischa Barton) Nominated

The above table uses rowspan = "x" (when x is the number of rows you want a box to cover) instead of writing out the year more than one. You can also use this in any table as long as the row you want to stretch doesn't contain template (IE {{template}} ).

Use the following code to add a rowspan

|rowspan = "x" | details you want to strech