Correct semantic representation for adding or describing a title

Say I have content in the form

<h2>George Epworth</h2> <h3>Director</h3> <p>Content Content Content</p> 

There I described the narrative part of h2 as h3, but this is really a big part of h2, isn't it? h3 does not exist on its own and depends on h2. Just trying to think of the most flexible way to define this element ...

+4
source share
2 answers

With HTML 5, you should use the hgroup element:

 <hgroup> <h2>George Epworth</h2> <h3>Director</h3> </hgroup> <p>Content Content Content</p> 

Optionally wrap it all in a <section> element.

+4
source

With semantics, the general page should be studied; without it, it is difficult to recommend an approach. This is how I see it:

You can consider H1-H6 as a hierarchy of importance of headings, ask yourself if the value changes from "name" to "job title" - if so, then dividing them into h2 and h3 is a semantic way.

In my opinion, a more accurate representation is the definition list approach:

 <dl> <dt>[Name]</dt> <dd>[Job Title]</dd> </dl> 

You can still add the <h2> and <h3> elements, but I believe that they are enough to represent the data, they can be created accordingly and contain more information via <dd> .

0
source

All Articles