CreateaFreeWebsite  with Responsive Web Design

General

 

9 Step Tutor

Header Element in HTML5

The Header Element or Tag has been introduced for producing better content structure in HTML5 documents:
The code:
<header></header>
Presents a group of introductory and or navigational aids.

A header element can contain the section's heading as (an hgroup element), but is not required.

The header element can also be used to wrap a section's table of contents, a search form, or any site logos.

Note: You can have more than one <header> element in an HTML document. However, <header> should not be placed within a footer, address or nested in another <header> element.

Code examples: The code below shows one instance of using a header element on a web page. The navigation device is nested within the header element.

<body>
 <header>
  <p>Website Name</p>
    <nav>
    <ul>
    <li><a href="index.html">Index of all articles</a></li>
    <li><a href="foo1.html">Article Link 1</a></li>
    <li><a href="foo2.html">Article link 2</a></li>
   </ul>
  </nav>
 </header>
<main>
<h1>Web Page Title</h1>
Web Page Content here....
</main>

Another acceptable option, where the nav element is placed before the header which is nested in main.

<body>
<nav>
   <ul>
    <li><a href="index.html">Index of all articles</a></li>
    <li><a href="foo1.html">Article Link 1</a></li>
    <li><a href="foo2.html">Article link 2</a></li>
   </ul>
</nav>
<main>
<header>
  <h1>Web Page Title</h1>
</header>
Web Page content here
</main>
</body>

Notice that the Nav element can be nested inside the header or placed above or below it (Shown below). Both are accepted practices.

There are other ways to use the header element which you can pursue if interested.

 

Another example of <header> nested in <main>:

<body>
<main>
  <header>
    <h1>A heading here</h1>
    <p>Posted by Author</p>
    <p>More information about document...</p>
  </header>
  <p>Actual page content....</p>
</main>
</body>

 

New Elements and Beginners

Some of the new tags used as shown below might make the body code of a basic HTML5 document easier to read.

This structure can be used instead of using class customized divisions .

<body>
<header></header>
<nav></nav>
<main>
Text and pics here
</main>
<footer></footer>
</body>

The old way:

<body>
<div class="header"></div>
<div class="navigation"></div>
<div class="main">
Text and pics here
</div>
<div class="footer"></div>
</body>

 

*Use of the new tags article, section, header, footer, hgroup, nav and aside is a matter of the taste or the need of the author.

Note: some of these elements overlap in purpose.

The Header Element accepts Global Attributes.

For a complete list of All elements, tags and attributes in HTML5 visit W3schools.com

 

 

See: The Division Tag and the Section Element or use the Next button for the next logical page, the Nav element.

 

Free Tools and Resources We Recommend

Free Responsive Web Design Certification freeCodeCamp
freeCodeCamp is a proven path to your first software developer job.
More than 40,000 people have gotten developer jobs after completing this – including at big companies like Google and Microsoft.
Finally, you'll learn how to make webpages that respond to different screen sizes by building a Twitter card with Flexbox, and a complex blog layout with CSS Grid.
FREE Certification Courses!!
Free Ebook How to Code in HTML5 and CSS3
"How to Code in HTML5 and CSS3" is a free e-book about making websites in HTML5 and CSS for absolute beginners. It doesn't require any experience in IT to start....
FREE HTML Editor (Windows): NoteTab Light
All the features of a commercial HTML editor.
FREE Apache Server (Windows): IndigoAmpp
Set up a real time server environment right on your PC. Test forms and scripts before uploading to your web space.
Linux Users
If like us, you've left the insane world of Microsoft Windows for the even worse experience of Linux, we recommend the BlueFish HTML editor. You'll find it in your software repository. It does have some QUIRKS, but it's FREE.
For image resizing we've found the easiest Linux tool to be Krita.

Have you tried out RWD template kit? Download Template #402 - 6 Page Kit