Header tag in HTML
The header tag is often used to represent the introductory content of the website, like some headings, navigation links, logo, and some other information. You can use several header tags in one HTML document, but don’t use a header tag inside the header tag, a footer tag, etc.
Below is the code for understanding the header tag →
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Some heading here…</title>
</head>
<body>
<header>
<img src=”logo.png” alt=”GyaniPandit logo” width=”100px” height=”50px”>
<nav>
<a href=”#”>Home</a>
<a href=”#”>Services</a>
<a href=”#”>About us</a>
<a href=”#”>Explore</a>
</nav>
<h1>Welcome to the best webpage!</h1>
</header>
</body>
</html>
If we try opening the file in the browser, the output is something like this –