html - HTML5 的 <figure> 标签中使用哪个标题?

标签 html semantic-markup figure

我读了这个问题:Do I still need to use the title attribute if my element has a `<figcaption>`?

但答案是面向img标签,但是,如果我有以下 figure ,没有img ,但带有 table :

<figure title="The table of life">
  <table>
    <caption>The table of life</caption>
    <tbody>...</tbody>
  </table>
  <figcaption>The table of life<figcaption>
</figure>

这里我有 3 种提供标题的方法:<caption>标签(仅适用于 table ), <figcaption>标签(仅适用于 figure )和 title属性(通用)。

哪个更好用?

这是 figure 的示例没有table :

<figure title="Description of my char in RPG">
  <h1>Seninha</h1>
  <p>Seninha was born in the moon in the year of 13...<p>
  <dl>
    <dt>HP</dt><dd>15</dd>
    <dt>MP</dt><dd>18</dd>
    <dt>IQ</dt><dd>99999</dd>
    <dt>ST</dt><dd>-10</dd>
  </dl>
  <figcaption>Description of my char in RPG<figcaption>
</figure>

最佳答案

caption仅作为 table 的子项有效。 The MDN docs for caption note :

Usage note: When the <table> element that is the parent of this <caption> is the only descendant of a <figure> element, use the <figcaption> element instead.

我会省略 title属性,因为它没有任何贡献。

关于html - HTML5 的 <figure> 标签中使用哪个标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23851404/

相关文章:

html - 在页脚 HTML 和 CSS 中水平居中对齐图像

html - 用于工作台行的 polymer 铁选择器

HTML5 中的纯 JavaScript 链接

html - 侧边栏中的主导航 - 使用哪个语义标签?

image - 如何在 LaTeX 中强制两个图形保持在同一页面上?

jquery - 全宽 Bootstrap 下拉菜单

html - css3中带有 Sprite 图像的背景过渡?

html - hreflang 和 lang 属性的语义使用

python - 如何在 Python 中的一个图中设置子图

python - 用条形图表示统计上的显着差异