Welcome to Wars Wiki!
Welcome, new users! For help on where to start, look at our getting started page and our manual of style. Need more help? Ask a staff member!

User:Moydow/Sandbox: Difference between revisions

From Wars Wiki
Jump to navigationJump to search
(table help page. Do more later)
(→‎Simple tables: done for now)
Line 54: Line 54:
| Cell 2
| Cell 2
| Cell 3
| Cell 3
|}
|-
| The same table, with an added caption.
| <pre>{| class="wikitable"
|+ A test table
! Header 1
! Header 2
! Header 3
|-
| Cell 1
| Cell 2
| Cell 3
|}</pre>
|
{| class="wikitable"
|+ A test table
! Header 1
! Header 2
! Header 3
|-
| Cell 1
| Cell 2
| Cell 3
|}
|-
| The same table, with the wikicode contained on one line per row.
| <pre>{| class="wikitable"
! Header 1 !! Header 2 !! Header 3
|-
| Cell 1 || Cell 2 || Cell 3
|}</pre>
|
{| class="wikitable"
! Header 1 !! Header 2 !! Header 3
|-
| Cell 1 || Cell 2 || Cell 3
|}
|-
| An extended table, with randomly added header cells. Any cell can be designated as a "header" by using the <nowiki>!</nowiki> mark. Note that this effect cannot be achieved with the wikicode contained on one line per row.
| <pre>{| class="wikitable"
| Header 1
! Header 2
| Header 3
|-
| Cell 1
| Cell 2
! Cell 3
|-
! Cell A
! Cell B
| Cell C
|}</pre>
|
{| class="wikitable"
| Header 1
! Header 2
| Header 3
|-
| Cell 1
| Cell 2
! Cell 3
|-
! Cell A
! Cell B
| Cell C
|}
|}
|}
|}

Revision as of 00:32, 24 September 2010

Tables are a very useful tool for presenting data neatly. There are many different ways of using wikicode, HTML, and CSS, to achieve the desired appearance of the table, although in most situations, only the basics are required. Experiment in the Sandbox to get a feel for designing tables, and don't hesitate to ask for help where necessary.

Basic coding

Basic coding used in designing a table.
Code Purpose
{| Begins a table. Immediately after this, CSS coding (such as class="wikitable") to define the table's appearance should be written.
|+ Used between the table's start and first row to add a caption (which appears above the table, as above).
|- Defines the end of a row, and the beginning of a new one. It may be omitted at the end of the final row.
! Defines a heading. All text in this cell will be bolded, and centred, and the cell will be highlighted.
| Defines a basic cell.
|} Ends the table.
  • Important: Each code must be placed at the beginning of a new line. However, an entire row may be placed on one line, by duplicating the code used to begin the row. This is explained further below.

Simple tables

A series of basic tables, and the required coding.
Description Wikicode Result
The most basic table, a 3x2 table with three headers.
{| class="wikitable"
! Header 1
! Header 2
! Header 3
|-
| Cell 1
| Cell 2
| Cell 3
|}
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
The same table, with an added caption.
{| class="wikitable"
|+ A test table
! Header 1
! Header 2
! Header 3
|-
| Cell 1
| Cell 2
| Cell 3
|}
A test table
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
The same table, with the wikicode contained on one line per row.
{| class="wikitable"
! Header 1 !! Header 2 !! Header 3
|-
| Cell 1 || Cell 2 || Cell 3
|}
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
An extended table, with randomly added header cells. Any cell can be designated as a "header" by using the ! mark. Note that this effect cannot be achieved with the wikicode contained on one line per row.
{| class="wikitable"
| Header 1
! Header 2
| Header 3
|-
| Cell 1
| Cell 2
! Cell 3
|-
! Cell A
! Cell B
| Cell C
|}
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell A Cell B Cell C