Help:Table caption

(Redirected from Help:Table Caption)

The caption tag is used inside the HTML element "table". This can also be done indirectly using the code "|+" as part of the wikicode for a table.

Captions are placed above the table by default. Captions can also be placed below, to the left, or to the right of the table, based on the value of the "align" parameter.

This is a caption placed to the left of the table.
This is a caption
Data-type-1 Data-type-2
Data-1a Data-2a
Data-1b Data-2b
Wiki code: <syntaxhighlight lang="wikitext">
This is a caption
Data-type-1 Data-type-2
Data-1a Data-2a
Data-1b Data-2b

</syntaxhighlight>

HTML code: <syntaxhighlight lang="html">
This is a caption
Data-type-1 Data-type-2
Data-1a Data-2a
Data-1b Data-2b

</syntaxhighlight>

A HTML <caption> tag can be created by using following wiki code:

|+ Caption

which generates the following HTML code:

<caption>Caption</caption>

You can also use parameters in wiki code:

|+ params|Caption

which will generate the HTML code:

<caption params>Caption</caption>

CSS box model equivalent:

display: table-caption;

The caption tag accepts the following parameters:

align = "top|bottom|left|right"

Equivalent stylesheet (CSS) parameters:

style="caption-side: top|bottom|left|right|inherit;"
Caption below the table
Data-type-1 Data-type-2
Data-1a Data-2a
Data-1b Data-2b
Caption to the right of the table
Wiki code:  <syntaxhighlight lang="wikitext">
Caption below the table
Data-type-1 Data-type-2
Data-1a Data-2a
Data-1b Data-2b
Caption to the right of the table

</syntaxhighlight>

For a right-aligned caption below the table:

|+ align="bottom" style="caption-side: bottom; text-align: right;" | Caption at bottom

See also