Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is <header> a semantic or structural tag

Tags:

html

Take these two pieces of markup:

<div id="header">
  <img src="/img/logo.png" alt="MyLogo" />

  <ul id="misc-nav">
    <li>..</li>
  </ul>

  <header>
    <h1>Welcome to Bob's Website of Fantastical Conbobulations</h1>
    <p>The smell of invention awaits you...</p>
  </header>
</div>

and

<header>
  <img src="/img/logo.png" alt="MyLogo" />

  <ul id="misc-nav">
    <li>..</li>
  </ul>

  <h1>Welcome to Bob's Website of Fantastical Conbobulations</h1>
  <p>The smell of invention awaits you...</p>
</header>

My example may not be perfect, but I'd like to know if the purpose of the tag is for semantic definition of the content, or is it block level structural definition with CSS?

It is my understanding from the spec itself, that the first example is the correct interpretation, yet I see the second being touted as the right way.

Can you offer any clarity on it?

like image 756
Andrew Weir Avatar asked Jan 09 '11 21:01

Andrew Weir


People also ask

Is h1 a semantic tag?

Semantics in HTML In HTML, for example, the <h1> element is a semantic element, which gives the text it wraps around the role (or meaning) of "a top level heading on your page."

What are semantic headings?

Overview. Use semantic markup (headings, lists, etc.) to properly represent the structure of the document. All elements should have complete start and end tags, be nested according to their specifications, not contain duplicate attributes.


1 Answers

Both are fine. But what exactly do you mean by "structural" vs "semantic"?

like image 170
Ian Hickson Avatar answered Sep 28 '22 11:09

Ian Hickson