Welcome to WebmasterWorld Guest from 54.145.208.64

Forum Moderators: incrediBILL

Message Too Old, No Replies

Can I Use Two Header Tags in a Row

   
9:35 pm on Jul 24, 2014 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



In the following thread [webmasterworld.com...] (msg 4644863) I have something similar to the following:

- <header>
-- <p>Text here (Site title)</p>
-- <nav><ul><li>Link 1</li><li>Link 2</li><li>Link 3</li><li>Link 4</li></ul></nav>
-- <h1>Text here</h1>
-- <p>Few words to describe what body text is about</p>
- </header>

Would I be able to do the following instead:

- <header>
-- <p>Text here (Site title)</p>
-- <nav><ul><li>Link 1</li><li>Link 2</li><li>Link 3</li><li>Link 4</li></ul></nav>
- </header>
- <header>
-- <h1>Text here</h1>
-- <p>Few words to describe what body text is about</p>
- </header>
- <p>Couple of sentences here</p>
- <p>Couple of sentences here</p>

The content within the first <header> would be sitewide and the content within the second <header> would be page-specific.

The <p>Couple of sentences here</p> is the body text and would be unique to each page.

I appreciate your help.
8:56 am on Jul 25, 2014 (gmt 0)

WebmasterWorld Senior Member piatkow is a WebmasterWorld Top Contributor of All Time 5+ Year Member



From W3schools:

Definition and Usage

The <header> tag specifies a header for a document or section.

The <header> element should be used as a container for introductory content or set of navigational links.

You can have several <header> elements in one document.

Note: A <header> tag cannot be placed within a <footer>, <address> or another <header> element.
6:42 pm on Jul 25, 2014 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



the content within the second <header> would be page-specific.

But "page-specific" can have a wide range of meanings. At one end is "stuff containing this page's <h1>" which may not count as a header at all. At the other end is "navigation that distinguishes between the present page and other pages" which may not really count as "page-specific".

If the issue is that the two sections are produced by two different include files, I know the feeling :) I like to keep each include symmetrical: if it contains the opening to some element, it should also contain its closing. (This is probably a good habit in principle, but it isn't the only habit.)
2:58 pm on Jul 27, 2014 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



piatkow,

From reading what you posted, I think that it is okay to include the two <header> elements in the way that I have in my OP.

Do you think that it would be okay to do this?

lucy24,

Those are some good points about what page-specific can mean. On the About Us page, the <h1> will probably be About Us and on the Contact page, the <h1> will probably be Contact Us.

Does this help to decide whether it would be okay to code with the two <header> elements in the way that I have in my OP?

Regarding includes, I am not sure if the two sections are produced by two different include files, but it's a good point.