开发者

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>&开发者_运维问答lt;/tbody>
    <tfooter></tfooter>
    <caption>My Table - End</caption>
</table>


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜