Menu
Coddy logo textTech

The Title Tag

Part of the Styling with CSS section of Coddy's HTML journey — lesson 5 of 76.

In HTML, the title tag is used to define the title of the HTML document. This title is displayed in the browser's title bar or in the page's tab. The title tag is placed within the <head> section of the HTML document.

Here's an example of how to use the title tag in an HTML document:

<!DOCTYPE html>
<html>
<head>
    <title>My Web Page</title>
    <style>
        body {
            background-color: lightblue;
        }
    </style>
</head>
<body>
    <h1>Welcome to My Page</h1>
    <p>This is a paragraph of text.</p>
</body>
</html>

In this example, the title tag sets the title of the page to "My Web Page". When you open this HTML file in a browser, you will see "My Web Page" in the title bar or tab.

challenge icon

Challenge

Easy

You are given an HTML document. Add a title to the HTML document that says: My Cool CSS Page

Cheat sheet

The title tag defines the title of an HTML document, which appears in the browser's title bar or tab. It must be placed within the <head> section:

<head>
    <title>My Web Page</title>
</head>

Try it yourself

<!DOCTYPE html>
<html>
<head>
    <style>
        body {
            background-color: lightblue;
        }
    </style>
</head>
<body>
    <h1>Welcome to My Page</h1>
    <p>This is a paragraph of text.</p>
</body>
</html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Styling with CSS