HTML Page Title


🔹 What is a Page Title?

The HTML page title is the text shown in the browser tab, search engine results, and bookmarks. It gives users and search engines a quick summary of what the page is about.


🔹 How to Set a Page Title

The page title is defined inside the <title> tag, which must be placed inside the <head> section of your HTML document.

✅ Syntax:
<!DOCTYPE html>
<html>
<head>
  <title>My First Web Page</title>
</head>
<body>
  <h1>Welcome to My Website</h1>
</body>
</html>

🔹 Importance of Page Title

Purpose Description
Browser Tab Shows title on the tab
Search Engine Results (SEO) Appears as the clickable headline in Google
Bookmarks/Favorites Used as label when user bookmarks the page

🔹 Tips for Writing Good Page Titles

  • Be descriptive and concise (50–60 characters)

  • Include important keywords for SEO

  • Avoid keyword stuffing

  • Make it unique for every page


🔹 Example: Title for a Blog Page

<head>
  <title>How to Cook Perfect Pasta - Food Blog</title>
</head>

🔹 Example: Dynamic Title using JavaScript (Optional)

<script>
  document.title = "Dynamic Page Title";
</script>

⚠ Use JavaScript title changes cautiously as they can confuse users and search engines.


Practice Questions

Q1. Create an HTML page and give it the title “Welcome Page”.

Q2. Write the correct code to display “Contact Us” as the page title.

Q3. Place the <title> tag inside the <head> section.

Q4. Create a title for a portfolio page: “John Doe – Web Developer”.

Q5. Use JavaScript to change the title after 3 seconds.

Q6. Write a title for an HTML tutorial page.

Q7. Make sure your HTML file shows “Home - MySite” in the browser tab.

Q8. Add different titles for two different HTML pages.

Q9. Write a short and SEO-friendly title for a travel website.

Q10. Bookmark your test page and verify the title appears correctly.


HTML Page Title Quiz

Q1: Which tag defines the title of a web page?

A. <header>
B. <h1>
C. <title>
D. <meta>

Q2: Where is the <title> tag placed in an HTML document?

A. Inside <body>
B. Inside <footer>
C. Inside <head>
D. After </html>

Q3: What does the page title affect?

A. Text color
B. SEO and browser tab text
C. Font family
D. Page alignment

Q4: Which of the following is a good title for an HTML portfolio page?

A. Web
B. My Page
C. John’s Portfolio
D. Hello

Q5: Can you have more than one <title> tag in a single HTML page?

A. Yes
B. No
C. Only in <body>
D. Only in external CSS

Q6: What is the ideal character length for a page title (SEO)?

A. 10–20
B. 50–60
C. 80–100
D. No limit

Q7: What happens if <title> is missing from a page?

A. Browser displays error
B. Default file name shows in tab
C. Page won't load
D. Nothing

Q8: What does this code do '<title>About Us - Company</title>' ?

A. Adds a heading to the page
B. Adds a title to the page tab
C. Adds a meta tag
D. Adds a button

Q9: Which tag is best used to give a short description to search engines?

A. <meta>
B. <title>
C. <desc>
D. <name>

Q10: Which of the following is a bad practice for writing titles?

A. Keeping it short
B. Using important keywords
C. Writing "Home" for every page
D. Writing unique titles

Go Back Top