H1、H2、H3、H4、H5、H6 表内的 TH 标签?- HTML [英] H1, H2, H3, H4, H5, H6 inside table TH tags? - HTML

查看:39
本文介绍了H1、H2、H3、H4、H5、H6 表内的 TH 标签?- HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在 table TH 标签内使用 H1、H2、H3、H4、H5、H6 吗?- HTML

我尝试使用 w3 验证器进行验证,但它没有验证.我明白了:

元素 h4 不能作为第 th 元素的后代出现.<th><h4>橙色</h4></th>

我用的是HTML5,所以我觉得最好的办法是用

做一个表格,然后把

标签放进去.或者这也是一个坏主意?因为它看起来像这样:

第一个标题

<h4>第二个标题</h4><h4>第三个标题</h4><p>第一段</p><p>第二个段落</p><p>第三段</p>

我不知道这看起来如何,3 个关闭的标题标签,中间没有任何文本或段落.

解决方案

HTML living标准明确禁止这样做.th 元素 内容模型是如下(强调):

<块引用>

流内容,但没有页眉、页脚、分节内容或标题内容后代.

标题内容"指的是h1h2 等元素,以及 hgroup 元素:

<块引用>

标题内容定义了一个节的标题(无论是明确的使用分段内容元素标记,或由标题暗示内容本身).

h1 h2 h3 h4 h5 h6 hgroup

Can i use H1, H2, H3, H4, H5, H6 inside the table TH tags? - HTML

I tryed to validate with the w3 validator, but it doesn't validate. I get this:

The element h4 must not appear as a descendant of the th element.
<th><h4>Orange</h4></th>

I use HTML5, so i think that the best idea is to use <div> to make a table and then put the <H4> tags in it. Or is this a bad idea too? Because then it looks something like this:

<h4>first title</h4> <h4>second title</h4> <h4>third title</h4> 
<p>first parahraph</p> <p>second parahraph</p> <p>third parahraph</p>

And i don't know how this looks, 3 heading tags that close, without any text or paragraphs between that.

解决方案

The HTML living standard explicity forbids this. The th element content model is as follows (emphasis added):

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

"Heading content" refers to the h1, h2 etc. elements, as well as the hgroup element:

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

这篇关于H1、H2、H3、H4、H5、H6 表内的 TH 标签?- HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆