Help:Table

From Disney•Pixar CARS Wiki
Jump to navigation Jump to search

Tables are useful for neatly displaying all kinds of data; You'll find them crammed into just about every corner of this wiki. Read on for a basic how-to of the formatting, coding, and styling process.

Basic formatting

{| class="wikitable"
|+ Name of My Table
! Header 1
! Header 2
|-
| Data 1
| Data 2
|-
| Data 3
| Data 4
|}
Name of My Table
Header 1 Header 2
Data 1 Data 2
Data 3 Data 4

Broken down;

{|
|}
table Opening and closing white curly brackets. Must be first on their respective line, else they will parse literally.
|+ caption Add a title, centered and bolded.
|- tr Begins a new row. Cells will continue horizontally until the next one appears.
! th Column header/title cell (sometimes used to label a row also)
| td Standard cell.

Rowspan and colspan allow you to extend one specific cell over more than one row and/or column. Be sure to "skip" that row/column (in the proceeding ones) the corresponding number of times.

Styling

Styling of borders, cell colors, and so on can be added at different points. To apply styling to the entire table, put the |style= attribute following {|.

{| class="wikitable" style="text-align:center"
|+Name of My Table
!Header 1
!Header 2
|-
|Data 1
|Data 2
|}

Each cell can also be styled individually, and will override the main table's rules. To do so, place it after the respective | or !. As seen below, the text in the Data 2 cell is aligned to the right, even though the table itself is center-aligned.

{| class="wikitable" style="text-align: center"
|+ Name of My Table
! Header 1
! Header 2
|-
| Data 1
| style="text-align:right"| Data 2
|}
Name of My Table
Header 1 Header 2
Data 1 Data 2

You also have the option to style an entire row at once. If you've picked up on the pattern, to do this you would place the style= right after the line-break starting that row.

{| class="wikitable" style="text-align:center"
|+
|Row 1
|Row 2
|- style="text-align:right"
|}

Besides customizing your own style set, you can also choose from a handful of pre-made design classes using the class= attribute.

  • .wikitable is generally our go-to.
  • .sortable + .plainrowheaders - Enable sortable arrows for each column. To exclude one, set .unsortable on that respective header cell.

Sample

Col. # Name Series Notes/variations Model image Packaging image
74 Tank Coat Pitty Race O Rama (2008-09)
{| class="wikitable" width="100%" style="text-align:center"
|-
! style="width:5%" | Col. #
! style="width:15%" | Name
! style="width:20%" | Series
! style="width:40%" | Notes/variations
! style="width:10%" | Model image
! style="width:10%" | Packaging image
|-
| [[List of vehicles by collector number|74]]
| [[Jerry Drivechain|Tank Coat Pitty]]
| [[Race O Rama Series|Race O Rama]] <small>(2008-09)</small>
| –
| [[File:Tank Coat Pitty diecast.jpg|100px]]
| [[File:Tcp09.jpg|80px]]
|}