- Courses
- HTML
- HTML top level tags
- <head>
- Difference between head and header elements
What is the difference between the <head>
and <header>
elements?
The <head>
element contains metadata for the document, while the <header>
element contains introductory content or navigational links.
The <head>
is designed for machine-readable information like titles, scripts, and styles, which help the browser understand how to process the page. In contrast, the <header>
is meant for human-readable content, such as the website's title, logo, or navigation menu, providing context and navigation options to users.
<head>
<title>Page Title</title>
</head>
<header>
<h1>Welcome to My Website</h1>
<nav>...</nav>
</header>