The Light
The Light

Reputation: 27021

How would it be possible to add a caption to the bottom of a table?

I have a table which has a caption which appears on top of the table.

I'd need another caption to appear at the bottom of the table. how would it be possible?

<table>
    <caption>My Table - Start</caption>
    <tbody></tbody>
    <tfooter></tfooter>
    <caption>My Table - End</caption>
</table>

Upvotes: 6

Views: 7361

Answers (3)

Elisabeth
Elisabeth

Reputation: 3032

You should put the <caption> at the top of the table, right below the <table> tag. Then you can use the CSS:

caption {
    caption-side: bottom;
}

to get it below the table. And only one caption per table as a previous person wrote. If you need a table title, then either use <th> or put a heading outside the table and use CSS to position it correctly.

Upvotes: 10

del.ave
del.ave

Reputation: 1948

I believe you can only have 1 caption per table and it must appear after the table tag. You could add a div right after the table and put your caption there.

Upvotes: 1

Cory Danielson
Cory Danielson

Reputation: 14501

You could mock one by doing the following, and applying some CSS

<table>
  <caption class="cap">some caption text</caption>
  <tr>
    <td>cell 1</td><td>cell 2</td><td>cell3</td>
  </tr>
  <tr>
    <td>cell 1</td><td>cell 2</td><td>cell3</td>
  </tr>
  <tr>
    <td>cell 1</td><td>cell 2</td><td>cell3</td>
  </tr>
  <tr>
    <td colspan="3" class="cap foot">
        This is pretty much a footer caption.
    </td>
  </tr>
</table>

Here's an example

Upvotes: 1

Related Questions