Which tag is used to define the header for HTML document ?
The <header> tag in HTML is used to define the header for a document. It 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.
In this article, we will discuss the tag that will define the header for an HTML document.
Syntax:
<header>
...
</header>
Example: In this example, we will see the tag which is used to define the header of the HTML element.
HTML
<!DOCTYPE html>
< html >
< head >
< title >
How to define a header for a document
or section using HTML?
</ title >
< style >
h1 {
color: green;
}
body {
text-align: center;
}
</ style >
</ head >
< body >
< header >
< h1 >GeeksforGeeks</ h1 >
< h2 >
How to define a header for a document
using HTML?
</ h2 >
< 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 >
|
Output:
Last Updated :
17 Jul, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...