H1、H2、H3、H4、H5、H6 表内的 TH 标签?- HTML
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11859671/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
H1, H2, H3, H4, H5, H6 inside table TH tags? - HTML
提问by Jo Smo
Can i use H1, H2, H3, H4, H5, H6
inside the table TH
tags? - HTML
我可以H1, H2, H3, H4, H5, H6
在table TH
标签内使用吗?- HTML
I tryed to validate with the w3 validator, but it doesn't validate. I get this:
我尝试使用 w3 验证器进行验证,但它没有验证。我明白了:
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:
我使用HTML5,所以我认为最好的想法是使用<div>
制作表格然后将<H4>
标签放入其中。或者这也是一个坏主意?因为它看起来像这样:
<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.
我不知道这看起来如何,3 个关闭的标题标签,中间没有任何文本或段落。
回答by James Allardice
The HTML living standardexplicity forbids this. The th
elementcontent model is as follows (emphasis added):
该生活标准的HTML明确地禁止这个。所述th
元素含量的模型是如下(强调):
Flow content, but with noheader, footer, sectioning content, or heading contentdescendants.
流内容,但没有页眉、页脚、分节内容或标题内容后代。
"Heading content" refers to the h1
, h2
etc. elements, as well as the hgroup
element:
“标题内容”指的是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
标题内容定义了一个节的标题(无论是使用节内容元素明确标记,还是由标题内容本身暗示)。
h1 h2 h3 h4 h5 h6 hgroup
回答by Dray
Yes .You can use the H1 , H2,.. H6
Tags inside the Table TH tags. These will do the same functionality in the table TH tag too. The text size of the table contents can be changes accordingly you needs.
是的。您可以使用H1 , H2,.. H6
Table TH 标签内的标签。这些也将在表 TH 标签中执行相同的功能。表格内容的文本大小可以根据需要进行相应更改。
Just see this linkfor the reference.
请参阅此链接以供参考。
回答by Utkanos
In terms of valid HTML? Yes.
就有效的 HTML 而言?是的。
In terms of it being a good idea? Yes - these are heading areas and such are good candidates for a H tag.
就这是一个好主意而言?是的 - 这些是标题区域,是 H 标签的良好候选者。
There is a school of thought that you shouldn't use one tag merely to enclose another, so you could argue the heading text should sit directly in the th
. However from an SEO perspective it is the H tag that is more important, so you frequently see this sort of thing:
有一种观点认为你不应该仅仅使用一个标签来包围另一个标签,所以你可以争辩说标题文本应该直接放在th
. 然而,从 SEO 的角度来看,H 标签更重要,所以你经常看到这样的事情:
<th><h3>Some heading</h3></th>
回答by denisoid
Yes, but TH means table header, I think header in table header is not good for semantic. Maybe it good for SEO.
是的,但是 TH 表示表头,我认为表头中的表头不利于语义。也许这对 SEO 有好处。