Difference between revisions of "Help:Tables"

(rmv category)
(class="wikitable")
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Outside of the normal HTML table syntax, there is a separate wikisyntax specifically for tables. (both wikitables and regular HTML tables can be used on this wiki)
+
Outside of the normal HTML table syntax, there is separate wikisyntax specifically for tables. (both wikitables and regular HTML tables can be used on this wiki)
  
 
Tables are started by <tt>{|</tt> and ended by <tt>|}</tt>. A new row is denoted by <tt>|-</tt>, while a new cell is denoted by <tt>|</tt> on a new line and <tt>||</tt> if there is more than one cell on a line.
 
Tables are started by <tt>{|</tt> and ended by <tt>|}</tt>. A new row is denoted by <tt>|-</tt>, while a new cell is denoted by <tt>|</tt> on a new line and <tt>||</tt> if there is more than one cell on a line.
 +
 +
After the declaration of any new row or cell, any number of HTML attributes can be added in standard form, as long as they are finished by another pipe: <tt>|</tt>
  
 
The following is the basic syntax for tables:
 
The following is the basic syntax for tables:
Line 19: Line 21:
  
 
{| style="background:yellow; border:1px solid black"
 
{| style="background:yellow; border:1px solid black"
 +
|+ Caption for the table
 +
|- <!-- Start of a new row -->
 +
| style =”width:75%” | The first cell || The second cell
 +
|-
 +
| An alternative scheme for cells
 +
|Second cell
 +
|}
 +
<pre>
 +
 +
 +
</pre>
 +
====Class="wikitable"====
 +
Inserting  <nowiki>class="wikitable"</nowiki>  will automatically apply borders, etc. to the table:
 +
<pre>
 +
 +
{| class="wikitable"
 +
|+ Caption for the table
 +
|- <!-- Start of a new row -->
 +
| style =”width:75%” | The first cell || The second cell
 +
|-
 +
| An alternative scheme for cells
 +
|Second cell
 +
|}
 +
</pre>
 +
 +
produces
 +
 +
{| class="wikitable"
 
|+ Caption for the table
 
|+ Caption for the table
 
|- <!-- Start of a new row -->
 
|- <!-- Start of a new row -->

Latest revision as of 18:51, 3 March 2014

Outside of the normal HTML table syntax, there is separate wikisyntax specifically for tables. (both wikitables and regular HTML tables can be used on this wiki)

Tables are started by {| and ended by |}. A new row is denoted by |-, while a new cell is denoted by | on a new line and || if there is more than one cell on a line.

After the declaration of any new row or cell, any number of HTML attributes can be added in standard form, as long as they are finished by another pipe: |

The following is the basic syntax for tables:

{| style="background:yellow; border:1px solid black"
|+ Caption for the table
|- <!-- Start of a new row -->
| style =”width:75%” | The first cell || The second cell
|-
| An alternative scheme for cells
|Second cell
|}

This produces:

Caption for the table
The first cell The second cell
An alternative scheme for cells Second cell


Class="wikitable"

Inserting class="wikitable" will automatically apply borders, etc. to the table:


{| class="wikitable"
|+ Caption for the table
|- <!-- Start of a new row -->
| style =”width:75%” | The first cell || The second cell
|-
| An alternative scheme for cells
|Second cell
|}

produces

Caption for the table
The first cell The second cell
An alternative scheme for cells Second cell

This article is a tutorial about the AoPSWiki or AoPS Forum.