Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The template I used as a start for my own design places the metadata inside the header tag of the single-post.php. Is that a correct use of header, or should there only be h-tags in there? What about the post image? Could that be part of the header?

share|improve this question
1  
What to you mean with "header"? <header>? Inside of the <header> tag there shouldn't be any headlines or images. –  s1lv3r Feb 23 '13 at 18:04
    
<header>, yes. And you are right. It should be <hgroup>. But what about that? Can there be anything else than <h>-tags inside? –  Lord_Mord Feb 23 '13 at 18:13

1 Answer 1

up vote 0 down vote accepted

The w3 specification says that only h-tags are allowed inside of the hgroup-tag. The basic purpose of it is to group a main-headline and a sub-headline together.

<hgroup>
  <h1>My maintitle</h1>
  <h2>Subtitle of my content</h2>
</hgroup>

edit html5 also adds the header-tag to use within the body. Inside of this any other html element is allowed. You just shouldn't confuse it with the head tag. :-)

share|improve this answer
    
If the specification says "typically contains" the headings, does it mean it can contain h-tags, depending on the context or it should contain them? When do I know if an element belongs there or not. The image for example. In my case the image is a 155px small circle with a person in it. In my feeling it is a header-thing. But if I would place it there, where would I stop placing things inside the header? Someone could feel like the meta information belongs there. Others could come up with the idea of placing the first paragraph inside. Is there any recommendation? –  Lord_Mord Feb 23 '13 at 19:00
    
hgroup = header group is an element that groups header .. so per definition it can only contain headings. :-) A heading (h1-h6) is allowed to contain any 'phrasing' element (dev.w3.org/html5/markup/common-models.html#common.elem.phrasing), this also includes images. Most developers simply use the w3c validator (validator.w3.org) to check their code. Anything that doesn't throw an error there is generally seen as OK. :-) –  s1lv3r Feb 23 '13 at 19:15
    
Oh sorry, I was talking about <header>, the specification says it "typically" containes h-tags. And I know that it would be valid, but is it according to what the <header>-tag was meant for? –  Lord_Mord Feb 23 '13 at 19:18
    
Ah ok, regarding the header tag you are technically free to use almost any element inside of it. Regarding semantics you are supposed to place introductive or navigational elements inside it. This can be h-tags, p-tags, images or any other element as long as it is for the above purposes. –  s1lv3r Feb 23 '13 at 20:10
    
Thank you very much. –  Lord_Mord Feb 23 '13 at 20:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.