(Translated by https://www.hiragana.jp/)
Help:Table caption - MediaWiki

Help:Table caption

PD Note: When you edit this page, you agree to release your contribution under the CC0. See Public Domain Help Pages for more info. PD

In HTML, the caption element is used within the table element to provide a title for a table. Alternatively, in wikitext, this can also be achieved using the code |+ within the wikitext syntax for creating tables.

By default, the text within the caption element is positioned above the table. However, the position of the caption text and the table can be adjusted to the left, right, etc. of the table by using the align parameter.

The text, This is a Caption, is the caption for the table on the right side.
This is a Caption
Data-Type-1 Data-Type-2
Data-1a Data-2a
Data-1b Data-2b
Wikitext:
{| border="1"
|+ This is a Caption
! Data-Type-1 !! Data-Type-2
|-
| Data-1a || Data-2a
|-
| Data-1b || Data-2b
|}
Html code:
<table border="1">
<caption> This is a Caption </caption>
<tr>
<th> Data-Type-1 </th><th> Data-Type-2 </th>
</tr><tr>
<td> Data-1a </td><td> Data-2a </td>
</tr><tr>
<td> Data-1b </td><td> Data-2b </td>
</tr>
</table>

To create an HTML <caption> tag in wikitext, you can use the below syntax:

|+ Caption

It will generate the below HTML code:

<caption>Caption text</caption>

To use parameters inside a caption using wikitext, you can use the below syntax:

|+ params|Caption

It will generate the below HTML code:

<caption params>Caption</caption>

The equivalent of the table caption in CSS:

display: table-caption;

A caption tag can accept the following parameters:

align = "top|bottom|left|right" (Deprecated html parameter)

  (Html "align" is valid for ~IE 6).

The equivalent of the align parameter in stylesheet:

style="caption-side: top|bottom|left|right|inherit;"
 
In the table on the right, the text, Caption at bottom, is displayed as the caption text at the bottom of the table.
Caption at bottom
Data-Type-1 Data-Type-2
Data-1a Data-2a
Data-1b Data-2b
Wikitext:  {| border="1"
|+ align="bottom" style="caption-side: bottom" | Caption at '''bottom'''
! Data-Type-1 !! Data-Type-2
|-
| Data-1a || Data-2a
|-
| Data-1b || Data-2b
|}

To place the caption text on the right-aligned bottom side, use:

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

See also

edit