Coding Now – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 9667708830
Back to HTML Notes
Topic #114

HTML Head Element

The <head> holds everything about the page that isn't directly displayed as content — metadata, the title, links to CSS, and information for browsers and search engines.

Typical Contents

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CodingNow – AI & Full Stack Institute</title>
    <meta name="description" content="Learn AI, Data Science and Full Stack development.">
    <link rel="canonical" href="https://codingnowai.in/">
    <link rel="icon" href="/favicon.ico">
    <link rel="stylesheet" href="/style.css">
</head>

What Belongs in the Head

ElementPurpose
<title>The browser tab text and default search result title. See Title Tag.
<meta charset>Character encoding — should be the first thing inside <head>. See Meta Charset.
<meta viewport>Controls mobile scaling. See Meta Viewport.
<meta description>The snippet shown in search results. See Meta Description.
<link>Stylesheets, favicons, canonical URLs. See Link Tag.
<script>Can appear in head (usually with defer) or body. See Script Tag.

Order Matters (Slightly)

Put <meta charset="UTF-8"> first, within the first 1024 bytes of the document — browsers need to know the encoding before parsing text that might contain special characters.

Common Mistakes

  • Putting visible content (like a heading meant to display on the page) inside <head> — it won't render there
  • Forgetting <meta charset="UTF-8"> or placing it too late in the document
  • Loading large <script> tags in the head without defer/async, blocking the page from rendering — see defer and async

Interview Relevance

Q: "What's the difference between head and header?" — a very common confusion between two similarly-named but completely unrelated tags; see header vs head for the direct answer.

Practice Question

Write a complete <head> section for a page titled "Contact Us" with a meta description and a link to an external stylesheet.

Related HTML Notes

Want to go beyond the notes?

Join CodingNow's HTML course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →