Skip to content Skip to sidebar Skip to footer

H1, H2, H3, H4, H5, H6 Inside Table Th Tags? - Html

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

Solution 1:

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

Solution 2:

In terms of valid HTML? Yes.

In terms of it being a good idea? Yes - these are heading areas and such are good candidates for a H tag.

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><h3>Some heading</h3></th>

Solution 3:

Yes, but TH means table header, I think header in table header is not good for semantic. Maybe it good for SEO.

Solution 4:

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.

Just see this link for the reference.

Post a Comment for "H1, H2, H3, H4, H5, H6 Inside Table Th Tags? - Html"