The page title in HTML is set using the <title>
tag.
The content of the <title>
tag appears in the browser tab and is important for SEO as it helps search engines understand the topic of the page.
How to Add a Page Title in HTML
- Place the
<title>
tag within the<head>
section of your HTML document. - The text inside the
<title>
tag is what will appear as the page title in the browser tab.
A detailed example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My Awesome Web Page</title> </head> <body> <h1>Welcome to My Awesome Web Page</h1> <p>This is an example of a web page with a title.</p> </body> </html>
Sets the title of the HTML document. This title appears in the browser's title bar or tab.
Additional Tips
- Make sure the title is descriptive and concise.
- The title should ideally be between 50-60 characters for optimal display in search engines.
- Use relevant keywords in the title to improve SEO but avoid keyword stuffing.
By following these steps, you can effectively set a page title in your HTML document, which helps in both user experience and SEO.