HTML <title> Tag โ Page Title
๐ Introduction
The <title> tag defines the title of a webpage, which appears in the browser tab.
It is placed inside the <head> section and is essential for:
- User experience
- Search engine optimization (SEO)
- Bookmark naming
๐งฑ Syntax
<title>Your Page Title</title>
๐ก Example
<!DOCTYPE html>
<html>
<head>
<title>My First Website</title>
</head>
<body>
<h1>Welcome!</h1>
<p>This is my website.</p>
</body>
</html>
๐ฅ๏ธ Output Explanation
- The text inside
<title>appears in the browser tab - It does NOT appear inside the page content
Example:
- Tab shows: My First Website
- Page shows: "Welcome!" and the paragraph
๐ฏ Why <title> is Important
1. ๐งญ User Experience
Users can quickly identify your page when multiple tabs are open.
2. ๐ SEO (Search Engine Optimization)
Search engines use the <title> to understand your page content.
โ A good title improves ranking โ It appears in search results
3. ๐ Bookmarks
When users save your page, the <title> becomes the bookmark name.
โ ๏ธ Tips & Best Practices
- Keep it clear and descriptive
- Avoid titles like: "Home" or "Page1"
- Use keywords related to your content
- Recommended length: 50โ60 characters
โ Good:
<title>Learn HTML Basics โ Beginner Guide</title>
โ Bad:
<title>Page</title>
๐ซ Common Mistakes
- Placing
<title>outside<head> - Using multiple
<title>tags (only ONE is allowed) - Leaving it empty
๐งช Mini Exercise
Create a page with:
- A meaningful title (about you or your project)
- Open it in your browser
- Change the title and refresh
๐ Observe how the tab name changes