A website, platform, blog, or web page’s header and footer are essential components. They usually include links to crucial web pages that target what users will want to see before placing an order or submitting an inquiry.
Open your existing project
Create a new file called header.js
Copy your header section
<header> --- </header>
const template = document.createElement(‘template’)
template.innerHTML=` // Paste your HTML code `
Append element to html page
const template = document.createElement('template'); template.innerHTML = ` // Paste your HTML code ` document.body.appendChild(template.content);
Link header.js file in Html page
Write in place of
Importance of header and footer :
The HTML tag is used to define a program's or section's header, as it carries information about the title and heading of the associated material. The section heading (an h1-h6 element or a hgroup> element) is commonly placed in the element, but it is not essential.
It can also be used to surround a table of contents, a query form, or other significant logos within a section. The tag is a new tag in HTML5 that acts as a container tag, containing a start tag, content, and an end tag. In a single document, there can be many elements. This tag can't be used inside of a , , or another element.