在表th或td标签中允许使用H1(HTML标题)吗?

前端之家收集整理的这篇文章主要介绍了在表th或td标签中允许使用H1(HTML标题)吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
TLDR:不允许.

我在这里找到我的答案:

Permitted parent elements for h1: Any element that can contain flow elements,
hgroup.

资料来源:https://www.w3.org/TR/html-markup/h1.htmlhttps://www.w3.org/TR/html-markup/th.html

解决方法

HTML living standard表示禁止这个. th element内容模型如下(重点增加):

Flow content,but with no header,footer,sectioning content,or heading content descendants.

Heading content”是指h1,h2等元素,以及hgroup元素:

Heading content defines the header of a section (whether explicitly
marked up using sectioning content elements,or implied by the heading
content itself).

h1 h2 h3 h4 h5 h6 hgroup

原文链接:https://www.f2er.com/html/230351.html

猜你在找的HTML相关文章