HTML 5 | <header> Tag

The <header> tag in HTML is used to define the header for a document or a section.

  • The header tag contains information related to the title and heading of the related content.
  • The <header> element is intended to usually contain the section’s heading (an h1-h6 element or an <hgroup> element), but this is not required.
  • The <header> element can also be used to wrap a section’s table of contents, a search form, or any relevant logos.
  • The <header> tag is a new tag in HTML5 and it requires a starting tag as well as an end tag.
  • There can be several <header> elements in one document.
  • A <header> tag cannot be placed within a <footer>, <address> or another <header> element.

Syntax:

<header> ...</header>

Below examples illustrate the <header> element in HTML:



Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>Header Tag</title>
    </head>
    <body>
        <article>
            <header>
                <h1>This is the heading.</h1>
                <h4>This is the sub-heading.</h4>
                <p>This is the metadata.</p>
            </header>
        </article>
    </body>
</html>                    

chevron_right


Output:

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>Header Tag</title>
    </head>
    <body>
        <header>
            <h1>GeeksforGeeks</h1>
            <p>
                <a href=
                    Algo</a> | 
                <a href=
                    DS</a> | 
                <a href=
                    Languages</a> |
                <a href=
                    Interview</a> |
                <a href=
                    Students</a> |
                <a href=
                    Gate</a> |
                <a href=
                    CS Subjects</a> |
                <a href=
                    Quizzes</a
            </p>
        </header>
    </body>
</html>                    

chevron_right


Output:

Supported Browsers: The browsers which supports <header> tag are given below:

  • Google Chrome 6.0
  • Internet Explorer 9.0
  • Firefox 4.0
  • Opera 11.1
  • Safari 5.0


My Personal Notes arrow_drop_up

I am a technology enthusiast who has a keen interest in programming I am pursuing Engineering in Computer Science from GEU, Dehradun I like to unwind by watching movies and English sitcomsI have a keen interest in music

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.