Mashairi ya Kifungu ya <caption> ya HTML

Definition and usage

<caption> The tag defines the table title.

The caption tag must follow the table tag. You can only define one title for each table.

Tip:By default, the table title will be centered above the table. However, the CSS properties text-align and caption-side can be used to align and place the title.

See also:

HTML DOM Reference Manual:Caption object

Instance

Example 1

Table with title:

<table>
  <caption>Monthly savings</caption>
  <tr>
    <th>Mwezi</th>
    <th>Depozito</th>
  </tr>
  <tr>
    <td>Januari</td>
    <td>¥3000</td>
  </tr>
</table>

Jifunze tena

Example 2

Title of the location table (using CSS):

<table>
  <caption style="text-align:right">my savings</caption>
  <tr>
    <th>Mwezi</th>
    <th>Depozito</th>
  </tr>
  <tr>
    <td>Januari</td>
    <td>¥3000</td>
  </tr>
</table>
<br>
<table>
  <caption style="caption-side:bottom">Myaani</caption>
  <tr>
    <th>Mwezi</th>
    <th>Depozito</th>
  </tr>
  <tr>
    <td>Januari</td>
    <td>¥3000</td>
  </tr>
</table>

Jifunze tena

Mawasiliano ya kinaingia

<caption> Mafupi ya kinaingia inasimamia Mawasiliano ya kinaingia ya HTML.

Mawasiliano ya kinaingia

<caption> Mafupi ya kinaingia inasimamia Mawasiliano ya kinaingia ya HTML.

Matokeo ya CSS wa kinaingia kinaingia

Vilelele vingine vya kinaingia kinaingia vitafutua matokeo kama hizi kwa ujumbe wa kinaingia kinaingia. <caption> Mwili:

caption {
  display: table-caption;
  text-align: center;
}

Jifunze tena

Msaada wa kinaingia cha kinaingia

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Msaada Msaada Msaada Msaada Msaada