HTML The Head Element

HTML Tutorial

HTML The Head Element

HTML The Head Element is a container for metadata (data about the webpage).

It does not display content directly on the page, but it is extremely important for:

  • SEO (search engines)

  • Page title & favicon

  • CSS & JavaScript linking

  • Responsiveness

  • Browser behavior


 1. What Is the <head> Element?

  • Placed inside <html>

  • Comes before <body>

  • Contains information about the page, not visible content


 2. Common Elements Inside <head>

<title> – Page Title (Mandatory)

  •  Shows in browser tab
  •  Used by search engines

<meta> – Metadata (Very Important)

Uses:

  • Character encoding

  • Mobile responsiveness

  • SEO description


<link> – External Files (CSS, Favicon)

  •  Links CSS & icons

<style> – Internal CSS


<script> – JavaScript (Optional)

<script src="script.js"></script>
  •  Usually placed at bottom of <body> 
  •  Can also be used in <head> with defer
<script src="script.js" defer></script>

 3. Complete Example of <head>


 


 4. Why <head> Is So Important?

  • Improves SEO ranking
  •  Controls page behavior
  •  Loads CSS & JS
  • Enables responsive design
  • Defines page identity

 5. <head> vs <body>

Feature<head><body>
Visible contentNoYes
MetadataYesNo
SEO infoYesNo
CSS/JS linksYesNo

Common Mistakes

  •  Putting content text inside <head> 
  •  Missing <title>
  •  Forgetting viewport meta tag
  •  Linking CSS in <body>

 Key Points to Remember

  • <head> stores metadata

  • Content inside <head> is not visible

  • <title> is mandatory

  • <meta viewport> is required for mobile

  • CSS & favicon are linked here

You may also like...