Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

H1, H2, H3, H4, H5, H6 inside table TH tags? - HTML

Tags:

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.

like image 792
Jo Smo Avatar asked Aug 08 '12 07:08

Jo Smo


People also ask

What are h1 H2 H3 h4 h5 h6 tags in HTML?

HTML defines six levels of headings. A heading element implies all the font changes, paragraph breaks before and after, and any white space necessary to render the heading. The heading elements are H1, H2, H3, H4, H5, and H6 with H1 being the highest (or most important) level and H6 the least.

How do you use h1 H2 H3 tags in HTML?

To break it down, remember: H1 = Main keywords and subject matter, what the overall post is about. H2 = Sections to break up content, using similar keywords to the H1 tag. H3 = Subcategories to further break up the content, making it easily scannable.

What is the purpose of using the tag h1 H2 H3 h4 h5 h6?

The h1, h2, h3, h4, h5, h6 tags are used to create text headers for a document. They can display the header text in one of six different sizes.

Can you put an h1 in a table?

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.


1 Answers

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

like image 61
James Allardice Avatar answered Sep 17 '22 18:09

James Allardice